Merge branch 'remove-singleton-object_id' of https://github.com/asteven/cdist
This commit is contained in:
commit
b84d3393a0
3 changed files with 8 additions and 11 deletions
|
@ -65,7 +65,7 @@ class CdistObject(object):
|
|||
STATE_RUNNING = "running"
|
||||
STATE_DONE = "done"
|
||||
|
||||
def __init__(self, cdist_type, base_path, object_id=None):
|
||||
def __init__(self, cdist_type, base_path, object_id=''):
|
||||
self.cdist_type = cdist_type # instance of Type
|
||||
self.base_path = base_path
|
||||
self.object_id = object_id
|
||||
|
@ -107,7 +107,6 @@ class CdistObject(object):
|
|||
|
||||
"""
|
||||
type_name = object_name.split(os.sep)[0]
|
||||
# FIXME: allow object without object_id? e.g. for singleton
|
||||
object_id = os.sep.join(object_name.split(os.sep)[1:])
|
||||
return type_name, object_id
|
||||
|
||||
|
|
|
@ -34,7 +34,7 @@ class Emulator(object):
|
|||
self.stdin = stdin
|
||||
self.env = env
|
||||
|
||||
self.object_id = False
|
||||
self.object_id = ''
|
||||
|
||||
self.global_path = self.env['__global']
|
||||
self.target_host = self.env['__target_host']
|
||||
|
@ -54,10 +54,10 @@ class Emulator(object):
|
|||
"""Add hostname and object to logs via logging Filter"""
|
||||
|
||||
prefix = self.target_host + ": (emulator)"
|
||||
|
||||
if self.object_id:
|
||||
prefix = prefix + " " + self.type_name + "/" + self.object_id
|
||||
|
||||
prefix = '{0}: emulator {1}'.format(
|
||||
self.target_host,
|
||||
core.CdistObject.join_name(self.type_name, self.object_id)
|
||||
)
|
||||
record.msg = prefix + ": " + record.msg
|
||||
|
||||
return True
|
||||
|
@ -122,9 +122,7 @@ class Emulator(object):
|
|||
|
||||
def setup_object(self):
|
||||
# Setup object_id - FIXME: unset / do not setup anymore!
|
||||
if self.cdist_type.is_singleton:
|
||||
self.object_id = "singleton"
|
||||
else:
|
||||
if not self.cdist_type.is_singleton:
|
||||
self.object_id = self.args.object_id[0]
|
||||
del self.args.object_id
|
||||
|
||||
|
|
|
@ -118,7 +118,7 @@ class AutoRequireEmulatorTestCase(test.CdistTestCase):
|
|||
initial_manifest = os.path.join(self.local.manifest_path, "init")
|
||||
self.manifest.run_initial_manifest(initial_manifest)
|
||||
cdist_type = core.CdistType(self.local.type_path, '__saturn')
|
||||
cdist_object = core.CdistObject(cdist_type, self.local.object_path, 'singleton')
|
||||
cdist_object = core.CdistObject(cdist_type, self.local.object_path)
|
||||
self.manifest.run_type_manifest(cdist_object)
|
||||
expected = ['__planet/Saturn', '__moon/Prometheus']
|
||||
self.assertEqual(sorted(cdist_object.autorequire), sorted(expected))
|
||||
|
|
Loading…
Reference in a new issue