allow force_default_on_freeze for master if frozen
This commit is contained in:
@ -560,8 +560,7 @@ class Settings(object):
|
||||
def setproperties(self,
|
||||
path,
|
||||
properties,
|
||||
config_bag,
|
||||
force=False):
|
||||
config_bag):
|
||||
"""save properties for specified path
|
||||
(never save properties if same has option properties)
|
||||
"""
|
||||
@ -587,11 +586,12 @@ class Settings(object):
|
||||
if opt and opt.impl_is_symlinkoption():
|
||||
raise TypeError(_("can't assign properties to the SymLinkOption \"{}\""
|
||||
"").format(opt.impl_get_display_name()))
|
||||
if not force:
|
||||
forbidden_properties = FORBIDDEN_SET_PROPERTIES & properties
|
||||
if forbidden_properties:
|
||||
raise ConfigError(_('cannot add those properties: {0}').format(
|
||||
' '.join(forbidden_properties)))
|
||||
if 'force_default_on_freeze' in properties and \
|
||||
'frozen' not in properties and \
|
||||
opt.impl_is_master_slaves('master'):
|
||||
raise ConfigError(_('a master ({0}) cannot have '
|
||||
'"force_default_on_freeze" property without "frozen"'
|
||||
'').format(opt.impl_get_display_name()))
|
||||
if not isinstance(properties, frozenset):
|
||||
raise TypeError(_('properties must be a frozenset'))
|
||||
self._p_.setproperties(path,
|
||||
@ -600,44 +600,6 @@ class Settings(object):
|
||||
self._getcontext().cfgimpl_reset_cache(opt=opt,
|
||||
path=path)
|
||||
|
||||
def addproperty(self,
|
||||
path,
|
||||
property_,
|
||||
config_bag):
|
||||
if property_ in FORBIDDEN_SET_PROPERTIES:
|
||||
raise ConfigError(_('cannot add this property: "{0}"').format(
|
||||
' '.join(property_)))
|
||||
|
||||
self_properties = config_bag.properties
|
||||
if self_properties is None:
|
||||
index = None
|
||||
self_properties = self.getproperties(path,
|
||||
index,
|
||||
config_bag,
|
||||
apply_requires=False)
|
||||
config_bag.properties = self_properties
|
||||
self.setproperties(path,
|
||||
self_properties | {property_},
|
||||
config_bag,
|
||||
force=True)
|
||||
|
||||
def popproperty(self,
|
||||
path,
|
||||
property_,
|
||||
config_bag):
|
||||
self_properties = config_bag.properties
|
||||
if self_properties is None:
|
||||
index = None
|
||||
self_properties = self.getproperties(path,
|
||||
index,
|
||||
config_bag,
|
||||
apply_requires=False)
|
||||
config_bag.properties = self_properties
|
||||
self.setproperties(path,
|
||||
self_properties - {property_},
|
||||
config_bag,
|
||||
force=True)
|
||||
|
||||
def set_context_permissive(self, permissive):
|
||||
self.setpermissive(None, None, permissive)
|
||||
|
||||
|
Reference in New Issue
Block a user