forked from whamcloud/integrated-manager-for-lustre
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Deduplicate lctl calls in iml-agent (whamcloud#2099)
Signed-off-by: Igor Pashev <pashev.igor@gmail.com>
- Loading branch information
Showing
6 changed files
with
21 additions
and
31 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
This file was deleted.
Oops, something went wrong.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,18 @@ | ||
use crate::agent_error::ImlAgentError; | ||
use futures::TryFutureExt; | ||
use iml_cmd::{CheckedCommandExt, Command}; | ||
use std::ffi::OsStr; | ||
|
||
pub async fn lctl(args: Vec<&str>) -> Result<std::process::Output, ImlAgentError> { | ||
/// Runs lctl with given arguments | ||
pub async fn lctl<I, S>(args: I) -> Result<String, ImlAgentError> | ||
where | ||
I: IntoIterator<Item = S>, | ||
S: AsRef<OsStr>, | ||
{ | ||
Command::new("/usr/sbin/lctl") | ||
.args(args) | ||
.checked_output() | ||
.err_into() | ||
.await | ||
.map(|o| String::from_utf8_lossy(&o.stdout).to_string()) | ||
} |