Skip to content

Commit

Permalink
Merge pull request #4 from RomanValov/master
Browse files Browse the repository at this point in the history
fix: minor changes to wording of peerdns and gateway switches.
  • Loading branch information
RomanValov committed Aug 12, 2019
2 parents c7b2930 + 7e27756 commit 39da728
Show file tree
Hide file tree
Showing 5 changed files with 50 additions and 42 deletions.
Binary file added doc/_static/ram-menu-net-multiple.gif
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added doc/_static/ram-menu-net-single.gif
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 3 additions & 3 deletions lib/ram/net/ifconfig/input
Original file line number Diff line number Diff line change
Expand Up @@ -88,15 +88,15 @@ def EditNetworkIface(config, ifname):
if not config['resolver']['peerdns'] == ifname:
ModifyPeerDnsDevice(config, ifname)
elif backup_peerdns and backup_peerdns != ifname:
ModifyPeerDnsDevice(config, backup_peerdns, show_confirm=False)
ModifyPeerDnsDevice(config, backup_peerdns)
else:
RemovePeerDnsDevice(config)

def __SwitchIfaceDefault():
if not config['routing']['default'] == ifname:
ModifyGatewayDevice(config, ifname)
elif backup_default and backup_default != ifname:
ModifyGatewayDevice(config, backup_default, show_confirm=False)
ModifyGatewayDevice(config, backup_default)
else:
RemoveGatewayDevice(config)

Expand Down Expand Up @@ -274,7 +274,7 @@ if __name__ == '__main__':
"No present network interfaces found!\n"
)

elif params.device != "no":
elif not params.device == "no":
ActNetworkIface(config, params.device)

ram.store('net.network', input=config)
48 changes: 26 additions & 22 deletions lib/ram/net/resolver/entry.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,20 +47,21 @@ def EnsurePeerDnsDevice(config):
ifconf_ = config['ifconfig'][ifname_]
iserror_, warning_ = CheckPeerDnsDevice(ifconf_)

if warning_:
if ram.widgets.AskViaButtons(
"Continue with device to obtain DNS addresses?",
"Current interface to obtain DNS configuration via DHCP:\n\n"
" %s\n\n"
" %s\n\n"
"Would you like to select another device?\n" % (
ifname_, warning_
),
"Select device ...", "Keep `%s`" % ifname_
):
SelectPeerDnsDevice(config)
elif iserror_:
return False
if not warning_:
pass
elif ram.widgets.AskViaButtons(
"Continue with device to obtain DNS addresses?",
"Current interface to obtain DNS configuration:\n\n"
" %s\n\n"
" %s\n\n"
"Would you like to select another device?\n" % (
ifname_, warning_
),
"Select device ...", "Keep `%s`" % ifname_
):
SelectPeerDnsDevice(config)
elif iserror_:
return False

return True

Expand Down Expand Up @@ -152,10 +153,11 @@ def RemovePeerDnsDevice(config, show_confirm=True, edit_address=False):

if not ram.widgets.AskViaButtons(
"Use static configuration?",
"Current interface to obtain DNS configuration via DHCP:\n\n"
"Current interface to obtain DNS configuration:\n\n"
" %s\n\n"
" %s\n\n"
"Would you like to use static configuration?\n" % (
"Proposed to use static DNS confiruation.\n\n"
"Would you like to continue?\n" % (
ifname_, warning_
)
):
Expand All @@ -174,10 +176,12 @@ def ModifyPeerDnsDevice(config, ifname, show_confirm=True):
if show_confirm:
iserror, warning = CheckPeerDnsDevice(ifconf)

if ifname_ == ifname and warning:
if not ram.widgets.AskViaButtons(
if ifname_ == ifname:
if not warning:
pass
elif not ram.widgets.AskViaButtons(
"Continue with device to obtain DNS addresses?",
"Current interface to obtain DNS configuration via DHCP:\n\n"
"Current interface to obtain DNS configuration:\n\n"
" %s\n\n"
" %s\n\n"
"Would you like to keep using device?\n" % (
Expand All @@ -194,7 +198,7 @@ def ModifyPeerDnsDevice(config, ifname, show_confirm=True):
if not ram.widgets.AskViaButtons(
"Use dynamic configuration?",
"Current DNS configuration is static.\n\n"
"Proposed interface to obtain DNS configuration via DHCP:\n\n"
"Proposed interface to obtain DNS configuration:\n\n"
" %s\n\n"
" %s\n\n"
"Would you like to continue?" % (
Expand All @@ -208,10 +212,10 @@ def ModifyPeerDnsDevice(config, ifname, show_confirm=True):

if not ram.widgets.AskViaButtons(
"Change device to obtain DNS addresses?",
"Current interface to obtain DNS configuration via DHCP:\n\n"
"Current interface to obtain DNS configuration:\n\n"
" %s\n\n"
" %s\n\n"
"Proposed interface to obtain DNS configuration via DHCP:\n\n"
"Proposed interface to obtain DNS configuration:\n\n"
" %s\n\n"
" %s\n\n"
"Would you like to continue?" % (
Expand Down
38 changes: 21 additions & 17 deletions lib/ram/net/routing/entry.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,20 +46,21 @@ def EnsureGatewayDevice(config):
ifconf_ = config['ifconfig'][ifname_]
iserror_, warning_ = CheckGatewayDevice(ifconf_)

if warning_:
if ram.widgets.AskViaButtons(
"Continue with device to use as default gateway?",
"Current default route interface:\n\n"
" %s\n\n"
" %s\n\n"
"Would you like to select another device?\n" % (
ifname_, warning_
),
"Select device ...", "Keep `%s`" % ifname_
):
SelectGatewayDevice(config)
elif iserror_:
return False
if not warning_:
pass
elif ram.widgets.AskViaButtons(
"Continue with device to use as default gateway?",
"Current default route interface:\n\n"
" %s\n\n"
" %s\n\n"
"Would you like to select another device?\n" % (
ifname_, warning_
),
"Select device ...", "Keep `%s`" % ifname_
):
SelectGatewayDevice(config)
elif iserror_:
return False

return True

Expand Down Expand Up @@ -147,7 +148,8 @@ def RemoveGatewayDevice(config, show_confirm=True):
"Current default route interface:\n\n"
" %s\n\n"
" %s\n\n"
"Would you like to reset default route interface?" % (
"Proposed to reset default route interface.\n\n"
"Would you like to continue?" % (
ifname_, warning_
)
):
Expand All @@ -163,8 +165,10 @@ def ModifyGatewayDevice(config, ifname, show_confirm=True, edit_address=False):
if show_confirm:
iserror, warning = CheckGatewayDevice(ifconf)

if ifname_ == ifname and warning:
if not ram.widgets.AskViaButtons(
if ifname_ == ifname:
if not warning:
pass
elif not ram.widgets.AskViaButtons(
"Continue with device to use as default gateway?",
"Current default route interface:\n\n"
" %s\n\n"
Expand Down

0 comments on commit 39da728

Please sign in to comment.