-
Notifications
You must be signed in to change notification settings - Fork 55
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #3728 from mulkieran/metadata-check
Add a command-line tool and module for pool inspection
- Loading branch information
Showing
7 changed files
with
840 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
// This Source Code Form is subject to the terms of the Mozilla Public | ||
// License, v. 2.0. If a copy of the MPL was not distributed with this | ||
// file, You can obtain one at http://mozilla.org/MPL/2.0/. | ||
|
||
use std::{fs, path::Path}; | ||
|
||
use stratisd::engine::pool_inspection::inspectors; | ||
|
||
pub fn run(infile: &Path, print: bool) -> Result<(), String> { | ||
let metadata_str = fs::read_to_string(infile) | ||
.map_err(|the_io_error| format!("Error opening file: {}", the_io_error))?; | ||
let metadata = serde_json::from_str(&metadata_str) | ||
.map_err(|the_json_error| format!("Error parsing json into structs: {}", the_json_error))?; | ||
|
||
if print { | ||
inspectors::print(&metadata).map_err(|the_error| format!("Error: {}", the_error)) | ||
} else { | ||
inspectors::check(&metadata).map_err(|the_error| format!("Error: {}", the_error)) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.