Swap to context fail method on error
This commit is contained in:
+1
-2
@@ -18,8 +18,7 @@ async def enable_advanced_dmz(mac_address: str) -> None:
|
||||
async with xmo.flipflop('Device/Services/BellNetworkCfg/AdvancedDMZ/Enable') as client:
|
||||
await client.set_value_by_xpath('Device/Services/BellNetworkCfg/AdvancedDMZ/AdvancedDMZhost', mac_address)
|
||||
except Exception as e:
|
||||
click.echo(e, err=True)
|
||||
raise click.Abort()
|
||||
ctx.fail(e)
|
||||
|
||||
|
||||
@xmo.cli.command()
|
||||
|
||||
+1
-3
@@ -29,6 +29,4 @@ async def set_dns_servers(client: SagemcomClient, dns_servers: tuple[IPv4Address
|
||||
)
|
||||
await client.set_value_by_xpath(f"Device/DNS/Relay/Forwardings/Forwarding[@uid={uid}]/Enable", True)
|
||||
except Exception as e:
|
||||
click.echo(e, err=True)
|
||||
raise click.Abort()
|
||||
|
||||
ctx.fail(e)
|
||||
|
||||
+1
-2
@@ -8,5 +8,4 @@ async def flush_log() -> None:
|
||||
async with xmo.flipflop('Device/DeviceInfo/FlushDeviceLog') as client:
|
||||
pass
|
||||
except Exception as e:
|
||||
click.echo(e, err=True)
|
||||
raise click.Abort()
|
||||
ctx.fail(e)
|
||||
|
||||
+1
-2
@@ -24,6 +24,5 @@ async def disable_wifi_radios(client: SagemcomClient, radios: tuple[str] | list[
|
||||
for alias in disable_radios:
|
||||
await client.set_value_by_xpath(f"Device/WiFi/Radios/Radio[Alias='{alias}']/Enable", False)
|
||||
except Exception as e:
|
||||
click.echo(e, err=True)
|
||||
raise click.Abort()
|
||||
ctx.fail(e)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user