Skip to content

Commit f3fe1dc

Browse files
committed
Remove unused migrate_from_networkmanager function and command
1 parent 8e4b6db commit f3fe1dc

File tree

2 files changed

+0
-64
lines changed

2 files changed

+0
-64
lines changed

gonotego/command_center/wifi_commands.py

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -100,23 +100,6 @@ def migrate_wifi_networks():
100100
say('No WiFi networks found to migrate.')
101101

102102

103-
@register_command('wifi-nm-migrate')
104-
def migrate_from_networkmanager():
105-
"""Migrate existing NetworkManager connections to Go Note Go settings."""
106-
networks = wifi.migrate_from_networkmanager()
107-
108-
if networks is None:
109-
say('Error reading NetworkManager connections.')
110-
return
111-
112-
# Save the extracted networks to Redis
113-
if networks:
114-
wifi.save_networks(networks)
115-
say(f'Migrated {len(networks)} WiFi networks from NetworkManager to settings.')
116-
else:
117-
say('No WiFi networks found to migrate.')
118-
119-
120103
@register_command('wifi-remove {}')
121104
def remove_wifi_network(ssid):
122105
networks = wifi.get_networks()

gonotego/settings/wifi.py

Lines changed: 0 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -210,50 +210,3 @@ def migrate_networks_from_wpa_supplicant():
210210
except Exception as e:
211211
print(f"Error migrating WiFi networks: {e}")
212212
return None
213-
214-
215-
def migrate_from_networkmanager():
216-
"""Scan NetworkManager connections and migrate to Redis."""
217-
try:
218-
# Get all wifi connections
219-
result = subprocess.run(
220-
["nmcli", "-t", "-f", "NAME,TYPE", "connection", "show"],
221-
capture_output=True, text=True, check=True
222-
)
223-
224-
wifi_connections = []
225-
for line in result.stdout.splitlines():
226-
parts = line.split(':', 1)
227-
if len(parts) == 2:
228-
name, conn_type = parts
229-
if conn_type == 'wifi':
230-
wifi_connections.append(name)
231-
232-
networks = []
233-
for conn_name in wifi_connections:
234-
# Get connection details
235-
result = subprocess.run(
236-
["sudo", "nmcli", "--show-secrets", "connection", "show", conn_name],
237-
capture_output=True, text=True, check=True
238-
)
239-
240-
# Parse output to get SSID and PSK
241-
ssid = None
242-
psk = None
243-
244-
for line in result.stdout.splitlines():
245-
if "802-11-wireless.ssid:" in line:
246-
ssid = line.split(":", 1)[1].strip()
247-
elif "802-11-wireless-security.psk:" in line:
248-
psk = line.split(":", 1)[1].strip()
249-
250-
if ssid:
251-
if psk:
252-
networks.append({'ssid': ssid, 'psk': psk})
253-
else:
254-
networks.append({'ssid': ssid})
255-
256-
return networks
257-
except Exception as e:
258-
print(f"Error migrating from NetworkManager: {e}")
259-
return None

0 commit comments

Comments
 (0)