Skip to content

Commit

Permalink
feat(vpn): add _online_offline_devices method to get vpn devices
Browse files Browse the repository at this point in the history
  • Loading branch information
guptadev21 committed Feb 21, 2025
1 parent dadab65 commit 8bcf184
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions riocli/device/vpn.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,13 +99,13 @@ def toggle_vpn(
try:
client = new_client()

online_devices = client.get_all_devices(online_device=True)
all_devices = client.get_all_devices()

final = process_devices(online_devices, devices)
final = process_devices(all_devices, devices)

click.secho(
"\nSetting the state of VPN client = {} on "
"the following online devices\n".format(enable),
"the following devices\n".format(enable),
fg="yellow",
)

Expand Down Expand Up @@ -146,17 +146,17 @@ def toggle_vpn(
raise SystemExit(1) from e


def process_devices(online_devices, devices) -> typing.List:
def process_devices(all_devices, devices) -> typing.List:
if len(devices) == 0:
click.secho(
"\n(No devices specified. State will be applied"
" to all online devices in the project)",
fg="cyan",
)
return online_devices
return all_devices

name_map, uuid_map = {}, {}
for device in online_devices:
for device in all_devices:
name_map[device.name] = device
uuid_map[device.uuid] = device

Expand All @@ -170,7 +170,6 @@ def process_devices(online_devices, devices) -> typing.List:

return final


def print_final_devices(final) -> None:
data = [[device.uuid, device.name, device.status] for device in final]
tabulate_data(data, headers=["UUID", "Name", "Status"])

0 comments on commit 8bcf184

Please sign in to comment.