Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def set_static(self, truthiness, interface):
intf = self.__get_interface(interface)
intf["static"] = utils.input_boolean(truthiness)
def set_is_dir(self, is_dir):
"""
If true, treat file resource as a directory. Templates are ignored.
"""
self.is_dir = utils.input_boolean(is_dir)
def set_repos_enabled(self, repos_enabled):
self.repos_enabled = utils.input_boolean(repos_enabled)
def set_is_definition(self, isdef):
self.is_definition = utils.input_boolean(isdef)
def set_enable_menu(self, enable_menu):
"""
Sets whether or not the profile will be listed in the default
PXE boot menu. This is pretty forgiving for YAML's sake.
"""
self.enable_menu = utils.input_boolean(enable_menu)
def __setattr__(self, name, value):
if name in DEFAULTS:
try:
if DEFAULTS[name][1] == "str":
value = str(value)
elif DEFAULTS[name][1] == "int":
value = int(value)
elif DEFAULTS[name][1] == "bool":
if utils.input_boolean(value):
value = 1
else:
value = 0
elif DEFAULTS[name][1] == "float":
value = float(value)
elif DEFAULTS[name][1] == "list":
value = utils.input_string_or_list(value)
elif DEFAULTS[name][1] == "dict":
value = utils.input_string_or_dict(value)[1]
except:
raise AttributeError
self.__dict__[name] = value
if not utils.update_settings_file(self.to_dict()):
raise AttributeError
def set_mirror_locally(self, value):
self.mirror_locally = utils.input_boolean(value)