Skip to content

Commit

Permalink
Support bundle can output to console (Azure#2563)
Browse files Browse the repository at this point in the history
This gives support bundle the ability to output to stdout instead of a file. This will be used to collect the bundle from a direct method. Allowing console output removes the need to write the bundle to disk
  • Loading branch information
lfitchett authored Feb 21, 2020
1 parent 1c04102 commit 91fd4fd
Show file tree
Hide file tree
Showing 4 changed files with 162 additions and 70 deletions.
2 changes: 1 addition & 1 deletion edgelet/iotedge/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ pub use crate::error::{Error, ErrorKind, FetchLatestVersionsReason};
pub use crate::list::List;
pub use crate::logs::Logs;
pub use crate::restart::Restart;
pub use crate::support_bundle::SupportBundle;
pub use crate::support_bundle::{OutputLocation, SupportBundle};
pub use crate::unknown::Unknown;
pub use crate::version::Version;

Expand Down
2 changes: 1 addition & 1 deletion edgelet/iotedge/src/logs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ pub fn pull_logs<M, W>(
) -> impl Future<Item = W, Error = Error> + Send
where
M: 'static + ModuleRuntime,
W: 'static + Write + Send,
W: Write + Send,
{
runtime
.logs(id, options)
Expand Down
12 changes: 9 additions & 3 deletions edgelet/iotedge/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,7 @@ fn run() -> Result<(), Error> {
.about("Bundles troubleshooting information")
.arg(
Arg::with_name("output")
.help("Path of output file")
.help("Location to output file. Use - for stdout")
.long("output")
.short("o")
.takes_value(true)
Expand Down Expand Up @@ -271,7 +271,7 @@ fn run() -> Result<(), Error> {
.takes_value(true),
).arg(
Arg::with_name("quiet")
.help("Suppress output")
.help("Suppress status output")
.long("quiet")
.short("q")
.takes_value(false),
Expand Down Expand Up @@ -384,13 +384,19 @@ fn run() -> Result<(), Error> {
let include_ms_only = args.is_present("include-edge-runtime-only");
let verbose = !args.is_present("quiet");
let iothub_hostname = args.value_of("iothub-hostname").map(ToOwned::to_owned);
let output_location = if location == "-" {
OutputLocation::Console
} else {
OutputLocation::File(location.to_owned())
};

tokio_runtime.block_on(
SupportBundle::new(
options,
location.to_owned(),
include_ms_only,
verbose,
iothub_hostname,
output_location,
runtime()?,
)
.execute(),
Expand Down
Loading

0 comments on commit 91fd4fd

Please sign in to comment.