tracking observe calls
This commit is contained in:
@@ -124,12 +124,21 @@ async fn main() -> Result<()> {
|
|||||||
fn observe(args: cli::ObserveArgs) -> Result<()> {
|
fn observe(args: cli::ObserveArgs) -> Result<()> {
|
||||||
let mut cmd = std::process::Command::new(resolve_wakey_binary());
|
let mut cmd = std::process::Command::new(resolve_wakey_binary());
|
||||||
cmd.arg("observe");
|
cmd.arg("observe");
|
||||||
|
let config_path = args.config.clone();
|
||||||
if let Ok(config) = config::load_config(&args.config) {
|
if let Ok(config) = config::load_config(&args.config) {
|
||||||
config::apply_local_path_env_to_command(&mut cmd, &config);
|
config::apply_local_path_env_to_command(&mut cmd, &config);
|
||||||
}
|
}
|
||||||
|
|
||||||
match args.command {
|
match args.command {
|
||||||
ObserveCommand::Dhcp(args) => {
|
ObserveCommand::Dhcp(args) => {
|
||||||
|
::tracing::debug!(
|
||||||
|
action = %args.action,
|
||||||
|
mac = %args.mac,
|
||||||
|
ip = ?args.ip,
|
||||||
|
hostname = ?args.hostname,
|
||||||
|
config = %config_path.display(),
|
||||||
|
"forwarding dhcp observation to wakey"
|
||||||
|
);
|
||||||
cmd.arg("dhcp")
|
cmd.arg("dhcp")
|
||||||
.arg("--action")
|
.arg("--action")
|
||||||
.arg(args.action)
|
.arg(args.action)
|
||||||
@@ -143,6 +152,13 @@ fn observe(args: cli::ObserveArgs) -> Result<()> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
ObserveCommand::Neigh(args) => {
|
ObserveCommand::Neigh(args) => {
|
||||||
|
::tracing::debug!(
|
||||||
|
action = %args.action,
|
||||||
|
mac = ?args.mac,
|
||||||
|
ip = ?args.ip,
|
||||||
|
config = %config_path.display(),
|
||||||
|
"forwarding neighbor observation to wakey"
|
||||||
|
);
|
||||||
cmd.arg("neigh").arg("--action").arg(args.action);
|
cmd.arg("neigh").arg("--action").arg(args.action);
|
||||||
if let Some(mac) = args.mac {
|
if let Some(mac) = args.mac {
|
||||||
cmd.arg("--mac").arg(mac);
|
cmd.arg("--mac").arg(mac);
|
||||||
@@ -154,6 +170,7 @@ fn observe(args: cli::ObserveArgs) -> Result<()> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
let status = cmd.status()?;
|
let status = cmd.status()?;
|
||||||
|
::tracing::debug!(%status, "wakey observe exited");
|
||||||
if !status.success() {
|
if !status.success() {
|
||||||
anyhow::bail!("wakey observe exited with {status}");
|
anyhow::bail!("wakey observe exited with {status}");
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -244,10 +244,10 @@ pub struct StateStatsArgs {
|
|||||||
// not the greatest thing ive used, this and the migration code gets deleted shortly anyways
|
// not the greatest thing ive used, this and the migration code gets deleted shortly anyways
|
||||||
#[derive(Args)]
|
#[derive(Args)]
|
||||||
pub struct ImportSledStateArgs {
|
pub struct ImportSledStateArgs {
|
||||||
#[arg(long)]
|
#[arg(long, visible_alias = "from")]
|
||||||
pub from_sled_state: PathBuf,
|
pub from_sled_state: PathBuf,
|
||||||
|
|
||||||
#[arg(long)]
|
#[arg(long, visible_alias = "to")]
|
||||||
pub to_state_file: PathBuf,
|
pub to_state_file: PathBuf,
|
||||||
|
|
||||||
#[arg(long)]
|
#[arg(long)]
|
||||||
|
|||||||
Reference in New Issue
Block a user