Skip to content
This repository has been archived by the owner on Jul 25, 2022. It is now read-only.

EX-1874 stratagem: iml-agent needs to be more verbose #2310

Merged
merged 2 commits into from
Oct 7, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
58 changes: 48 additions & 10 deletions iml-agent/src/cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -546,7 +546,7 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
files,
} => {
if action == action_filesync::ActionType::Pull {
tracing::error!("Pull is not available as an option");
eprintln!("Pull is not available as an option");
exit(exitcode::USAGE);
}
let llapi =
Expand All @@ -560,7 +560,7 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
let fids: Vec<_> = fids.into_iter().map(Result::unwrap).collect();
let errors: Vec<_> = errors.into_iter().map(Result::unwrap_err).collect();
if !errors.is_empty() {
tracing::error!("files not found, ignoring: {:?}", errors);
eprintln!("files not found, ignoring: {:?}", errors);
}
let fidlist: Vec<FidItem> = fids
.into_iter()
Expand All @@ -574,8 +574,30 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
action,
};

let _result =
let result =
action_filesync::process_fids((llapi.mntpt(), task_args, fidlist)).await;

match result {
Ok(reslist) => {
if reslist.is_empty() {
println!("success");
exit(0);
}

for err in reslist.iter() {
eprintln!(
"Failed to sync {} ({}) {}",
llapi.fid2path(&err.fid)?,
err.fid,
err.errno
);
}
}
Err(e) => {
eprintln!("filesync failed {}", e);
exit(exitcode::SOFTWARE);
}
}
}
StratagemClientCommand::CloudSync {
action,
Expand All @@ -593,7 +615,7 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
let fids: Vec<_> = fids.into_iter().map(Result::unwrap).collect();
let errors: Vec<_> = errors.into_iter().map(Result::unwrap_err).collect();
if !errors.is_empty() {
tracing::error!("files not found, ignoring: {:?}", errors);
eprintln!("files not found, ignoring: {:?}", errors);
}
let fidlist: Vec<FidItem> = fids
.into_iter()
Expand All @@ -607,12 +629,28 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
action,
};

if action_cloudsync::process_fids((llapi.mntpt(), task_args, fidlist))
.await
.is_err()
{
tracing::error!("Filesync failed");
exit(exitcode::IOERR);
let result =
action_cloudsync::process_fids((llapi.mntpt(), task_args, fidlist)).await;
match result {
Ok(reslist) => {
if reslist.is_empty() {
println!("success");
exit(0);
}

for err in reslist.iter() {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How large might this list be?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As many items as the user typed in (not more)

eprintln!(
"Failed to sync {} ({}) {}",
llapi.fid2path(&err.fid)?,
err.fid,
err.errno
);
}
}
Err(e) => {
eprintln!("cloudsync failed {}", e);
exit(exitcode::SOFTWARE)
}
}
}
},
Expand Down