Commit c931d60c authored by Thomas Gambier's avatar Thomas Gambier 🚴🏼

Correct default value in help for slapos node format

parent 175b5788
...@@ -62,13 +62,15 @@ class FormatCommand(ConfigCommand): ...@@ -62,13 +62,15 @@ class FormatCommand(ConfigCommand):
ap.add_argument('--alter_user', ap.add_argument('--alter_user',
choices=['True', 'False'], choices=['True', 'False'],
#default=FormatConfig.alter_user, #can't use default here because it would overwrite .cfg
help='Shall slapformat alter user database' help='Shall slapformat alter user database'
' (default: %(default)s)') ' (default: {})'.format(FormatConfig.alter_user))
ap.add_argument('--alter_network', ap.add_argument('--alter_network',
choices=['True', 'False'], choices=['True', 'False'],
#default=FormatConfig.alter_network, #can't use default here because it would overwrite .cfg
help='Shall slapformat alter network configuration' help='Shall slapformat alter network configuration'
' (default: %(default)s)') ' (default: {})'.format(FormatConfig.alter_network))
ap.add_argument('--now', ap.add_argument('--now',
default=False, default=False,
...@@ -87,11 +89,11 @@ class FormatCommand(ConfigCommand): ...@@ -87,11 +89,11 @@ class FormatCommand(ConfigCommand):
return ap return ap
def take_action(self, args): def take_action(self, args):
configp = self.fetch_config(args) configp = self.fetch_config(args) # read the options in .cfg
conf = FormatConfig(logger=self.app.log) conf = FormatConfig(logger=self.app.log)
conf.mergeConfig(args, configp) conf.mergeConfig(args, configp) # commandline options overwrite .cfg options
# Parse if we have to check if running from root # Parse if we have to check if running from root
# XXX document this feature. # XXX document this feature.
......
...@@ -1485,19 +1485,19 @@ def do_format(conf): ...@@ -1485,19 +1485,19 @@ def do_format(conf):
class FormatConfig(object): class FormatConfig(object):
key_file = None key_file = None
cert_file = None cert_file = None
alter_network = None alter_network = 'True'
alter_user = None alter_user = 'True'
create_tap = None create_tap = True
create_tun = None create_tun = False
computer_xml = None computer_xml = None
computer_json = None computer_json = None
input_definition_file = None input_definition_file = None
log_file = None log_file = None
output_definition_file = None output_definition_file = None
dry_run = None dry_run = None
software_user = None software_user = 'slapsoft'
tap_gateway_interface = None tap_gateway_interface = ''
use_unique_local_address_block = None use_unique_local_address_block = False
instance_storage_home = None instance_storage_home = None
def __init__(self, logger): def __init__(self, logger):
...@@ -1557,22 +1557,6 @@ class FormatConfig(object): ...@@ -1557,22 +1557,6 @@ class FormatConfig(object):
self.logger.warning('no_bridge option is deprecated and should be ' self.logger.warning('no_bridge option is deprecated and should be '
'replaced by create_tap.') 'replaced by create_tap.')
# Set defaults lately
if self.alter_network is None:
self.alter_network = 'True'
if self.alter_user is None:
self.alter_user = 'True'
if self.software_user is None:
self.software_user = 'slapsoft'
if self.create_tap is None:
self.create_tap = True
if self.create_tun is None:
self.create_tun = False
if self.tap_gateway_interface is None:
self.tap_gateway_interface = ''
if self.use_unique_local_address_block is None:
self.use_unique_local_address_block = False
# Convert strings to booleans # Convert strings to booleans
for option in ['alter_network', 'alter_user', 'create_tap', 'create_tun', 'use_unique_local_address_block']: for option in ['alter_network', 'alter_user', 'create_tap', 'create_tun', 'use_unique_local_address_block']:
attr = getattr(self, option) attr = getattr(self, option)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment