Store puppet config in context
This commit stores current host config in puppet context to facilitate access between modules. This would allow the subsequent modules to obtain the existing resources and extend/override them. Story: 2004628 Task: 28557 Change-Id: I2c30829093572359388d016f5008d6906a61f651 Signed-off-by: eric zhang <eric.zhang@windriver.com>
This commit is contained in:
parent
d52655f956
commit
2b8de4d8df
|
@ -50,6 +50,10 @@ class BasePuppet(object):
|
|||
def context(self):
|
||||
return self._operator.context
|
||||
|
||||
@property
|
||||
def config(self):
|
||||
return self._operator.config
|
||||
|
||||
def get_static_config(self):
|
||||
return {}
|
||||
|
||||
|
|
|
@ -56,6 +56,10 @@ class PuppetOperator(object):
|
|||
thread_context = eventlet.greenthread.getcurrent()
|
||||
return getattr(thread_context, '_puppet_context')
|
||||
|
||||
@property
|
||||
def config(self):
|
||||
return self.context.get('config', {})
|
||||
|
||||
@puppet_context
|
||||
def create_static_config(self):
|
||||
"""
|
||||
|
@ -69,7 +73,7 @@ class PuppetOperator(object):
|
|||
os.environ["XDG_DATA_HOME"] = "/tmp"
|
||||
|
||||
try:
|
||||
config = {}
|
||||
self.context['config'] = config = {}
|
||||
for puppet_plugin in self.puppet_plugins:
|
||||
config.update(puppet_plugin.obj.get_static_config())
|
||||
|
||||
|
@ -91,7 +95,7 @@ class PuppetOperator(object):
|
|||
os.environ["XDG_DATA_HOME"] = "/tmp"
|
||||
|
||||
try:
|
||||
config = {}
|
||||
self.context['config'] = config = {}
|
||||
for puppet_plugin in self.puppet_plugins:
|
||||
config.update(puppet_plugin.obj.get_secure_static_config())
|
||||
|
||||
|
@ -106,7 +110,7 @@ class PuppetOperator(object):
|
|||
"""Update the configuration for the system"""
|
||||
try:
|
||||
# NOTE: order is important due to cached context data
|
||||
config = {}
|
||||
self.context['config'] = config = {}
|
||||
for puppet_plugin in self.puppet_plugins:
|
||||
config.update(puppet_plugin.obj.get_system_config())
|
||||
|
||||
|
@ -121,7 +125,7 @@ class PuppetOperator(object):
|
|||
"""Update the secure configuration for the system"""
|
||||
try:
|
||||
# NOTE: order is important due to cached context data
|
||||
config = {}
|
||||
self.context['config'] = config = {}
|
||||
for puppet_plugin in self.puppet_plugins:
|
||||
config.update(puppet_plugin.obj.get_secure_system_config())
|
||||
|
||||
|
@ -136,7 +140,7 @@ class PuppetOperator(object):
|
|||
"""Update the host hiera configuration files for the supplied host"""
|
||||
|
||||
self.config_uuid = config_uuid
|
||||
config = {}
|
||||
self.context['config'] = config = {}
|
||||
for puppet_plugin in self.puppet_plugins:
|
||||
config.update(puppet_plugin.obj.get_host_config(host))
|
||||
|
||||
|
|
Loading…
Reference in New Issue