Skip to content

Commit

Permalink
azure: log a warning on network failure if non-root
Browse files Browse the repository at this point in the history
This logs a warning about possible Azure-specific local firewalling if unable to reach Azure endpoints and running as non-root.

Closes: coreos#95
  • Loading branch information
bh7cw committed Jul 29, 2020
1 parent 34aed1f commit 2a3a29b
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion src/providers/azure/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ use crate::errors::*;
use crate::network;
use crate::providers::MetadataProvider;
use crate::retry;
use nix::unistd::Uid;

#[cfg(test)]
mod mock_tests;
Expand Down Expand Up @@ -216,7 +217,15 @@ impl Azure {
// make sure the metadata service is compatible with our version
azure
.is_fabric_compatible(MS_VERSION)
.chain_err(|| "failed version compatibility check")?;
.map_err(|_| {
let user = Uid::current();
let root_or_not = Uid::is_root(user);
if !root_or_not {
warn!("unable to reach Azure endpoints, please check whether firewall rules are blocking access to them");
}

"failed to get shared configuration: not found"
})?;

// populate goalstate
azure.goal_state = azure.get_goal_state()?;
Expand Down

0 comments on commit 2a3a29b

Please sign in to comment.