Browse Source

setting up CDIST_ALLOW_OVERRIDE to any value is ok - do not depend on true/yes/ja

Signed-off-by: Nico Schottelius <nico@bento.schottelius.org>
3.0
Nico Schottelius 9 years ago
parent
commit
34f2f7f038
  1. 4
      cdist/emulator.py
  2. 1
      docs/changelog
  3. 6
      docs/man/man7/cdist-manifest.text

4
cdist/emulator.py vendored

@ -145,14 +145,14 @@ class Emulator(object):
if value is not None:
self.parameters[key] = value
if self.cdist_object.exists and os.environ.get('CDIST_ALLOW_OVERRIDE',"false") != 'true':
if self.cdist_object.exists and not 'CDIST_ALLOW_OVERRIDE' in os.environ:
if self.cdist_object.parameters != self.parameters:
raise cdist.Error("Object %s already exists with conflicting parameters:\n%s: %s\n%s: %s"
% (self.cdist_object.name, " ".join(self.cdist_object.source), self.cdist_object.parameters, self.object_source, self.parameters)
)
else:
if self.cdist_object.exists:
self.log.debug('Object %s override forced with CDIST_ALLOW_OVERRIDE=true',self.cdist_object.name)
self.log.debug('Object %s override forced with CDIST_ALLOW_OVERRIDE',self.cdist_object.name)
self.cdist_object.create(True)
else:
self.cdist_object.create()

1
docs/changelog

@ -7,6 +7,7 @@ Changelog
3.0.5:
* Core: Introduce override concept (Daniel Heule)
* Type __process: Make --state absent work (Steven Armstrong)
* Documentation: Add documentation for influencing variables
3.0.4: 2014-01-29

6
docs/man/man7/cdist-manifest.text

@ -133,8 +133,8 @@ OVERRIDES
---------
In some special cases, you would like to create an already defined object
with different parameters. In normal situations this leads to an error in cdist.
If you whish, you can mark this second definition of an object with
CDIST_ALLOW_OVERRIDE=true to tell cdist, that this object override is
If you whish, you can setup the environment variable CDIST_ALLOW_OVERRIDE
(any value or even empty is ok) to tell cdist, that this object override is
wanted and should be accepted.
ATTENTION: Only use this feature if you are 100% sure in which order
cdist encounter the affected objects, otherwhise this results
@ -190,7 +190,7 @@ __user foobar --password 'some_fancy_hash' --home /home/foobarexample
__user foobar --password 'some_other_hash'
# this tells cdist, that you know that this is an override and should be accepted
CDIST_ALLOW_OVERRIDE=true __user foobar --password 'some_other_hash'
CDIST_ALLOW_OVERRIDE=yes __user foobar --password 'some_other_hash'
# its only an override, means the parameter --home is not touched
# and stay at the original value of /home/foobarexample
--------------------------------------------------------------------------------

Loading…
Cancel
Save