Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: enable/disable vpn in offline devices. #415

Merged
merged 1 commit into from
Feb 21, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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"])