Explained yaml_rust in code + extras
Some checks failed
continuous-integration/drone/push Build is failing

changed how we run version.sh
added mouse_out.yml to .gitignore
This commit is contained in:
Jochen Maes 2023-11-01 08:50:06 +01:00
parent 282fe70e69
commit 398d20cebb
3 changed files with 6 additions and 3 deletions

View File

@ -21,8 +21,8 @@ steps:
- name: build amd64 - name: build amd64
image: rust:1.73-alpine image: rust:1.73-alpine
commands: commands:
- ./version.sh - pwd && ls -al && ./version.sh
- apk add --no-cache musl-dev gcc-aarch64-none-elf - apk add --no-cache musl-dev gcc-aarch64-none-elf bash
- mkdir /artifacts/mouse-amd64 - mkdir /artifacts/mouse-amd64
- cp LICENSE.txt /artifacts/mouse-amd64/ - cp LICENSE.txt /artifacts/mouse-amd64/
- mkdir /artifacts/mouse-arm64 - mkdir /artifacts/mouse-arm64

1
.gitignore vendored
View File

@ -2,3 +2,4 @@
.vscode/ .vscode/
*.un~ *.un~
*.swp *.swp
mouse_out.yml

View File

@ -13,7 +13,6 @@ use crate::gatherers::environment::EnvironmentData;
use crate::gatherers::ip::{IPData, IPRouteData}; use crate::gatherers::ip::{IPData, IPRouteData};
use crate::types::fact::Fact; use crate::types::fact::Fact;
use clap::Parser; use clap::Parser;
use serde::de::Error;
use serde_json::Value; use serde_json::Value;
use std::collections::{HashMap, HashSet}; use std::collections::{HashMap, HashSet};
use yaml_rust::{YamlEmitter, YamlLoader}; use yaml_rust::{YamlEmitter, YamlLoader};
@ -92,6 +91,9 @@ fn main() {
match output_format { match output_format {
"json" => println!("{}", data_output), "json" => println!("{}", data_output),
"yaml" => { "yaml" => {
// We will run the string back through yaml_rust, for better output compatibility.
// We could choose to swwitch serde_yaml out completely but at this time I don't see
// a huge value, as once serde_yaml fixes their implementation,...
let tmp = format!("---\n{}", data_output); let tmp = format!("---\n{}", data_output);
let yr = YamlLoader::load_from_str(tmp.as_str()).unwrap(); let yr = YamlLoader::load_from_str(tmp.as_str()).unwrap();
let mut out = String::new(); let mut out = String::new();