forked from ungleich-public/cdist
Whitespace does not not weigh anything - remove - sed -i 's/ *$//g' *py */*py
Signed-off-by: Nico Schottelius <nico@brief.schottelius.org>
This commit is contained in:
parent
7160637014
commit
7bb81e2f18
9 changed files with 15 additions and 15 deletions
|
@ -19,7 +19,7 @@
|
||||||
#
|
#
|
||||||
#
|
#
|
||||||
|
|
||||||
BANNER = """
|
BANNER = """
|
||||||
.. . .x+=:. s
|
.. . .x+=:. s
|
||||||
dF @88> z` ^% :8
|
dF @88> z` ^% :8
|
||||||
'88bu. %8P . <k .88
|
'88bu. %8P . <k .88
|
||||||
|
|
|
@ -34,7 +34,7 @@ from cdist import core
|
||||||
class ConfigInstall(object):
|
class ConfigInstall(object):
|
||||||
"""Cdist main class to hold arbitrary data"""
|
"""Cdist main class to hold arbitrary data"""
|
||||||
|
|
||||||
def __init__(self, context):
|
def __init__(self, context):
|
||||||
|
|
||||||
self.context = context
|
self.context = context
|
||||||
self.log = logging.getLogger(self.context.target_host)
|
self.log = logging.getLogger(self.context.target_host)
|
||||||
|
@ -70,7 +70,7 @@ class ConfigInstall(object):
|
||||||
start_time = time.time()
|
start_time = time.time()
|
||||||
self.deploy_to()
|
self.deploy_to()
|
||||||
self.cleanup()
|
self.cleanup()
|
||||||
self.log.info("Finished run in %s seconds",
|
self.log.info("Finished run in %s seconds",
|
||||||
time.time() - start_time)
|
time.time() - start_time)
|
||||||
|
|
||||||
def stage_prepare(self):
|
def stage_prepare(self):
|
||||||
|
@ -135,7 +135,7 @@ class ConfigInstall(object):
|
||||||
cdist_object.ran = True
|
cdist_object.ran = True
|
||||||
|
|
||||||
cdist_type = cdist_object.type
|
cdist_type = cdist_object.type
|
||||||
|
|
||||||
for requirement in cdist_object.requirements:
|
for requirement in cdist_object.requirements:
|
||||||
self.log.debug("Object %s requires %s", cdist_object, requirement)
|
self.log.debug("Object %s requires %s", cdist_object, requirement)
|
||||||
# FIXME: requirement is a string, need to create object here
|
# FIXME: requirement is a string, need to create object here
|
||||||
|
|
|
@ -74,7 +74,7 @@ class Context(object):
|
||||||
self.remote_base_path = os.environ.get('__cdist_remote_out_dir', "/var/lib/cdist")
|
self.remote_base_path = os.environ.get('__cdist_remote_out_dir', "/var/lib/cdist")
|
||||||
self.remote_exec = os.environ.get('__remote_exec', "ssh -o User=root -q")
|
self.remote_exec = os.environ.get('__remote_exec', "ssh -o User=root -q")
|
||||||
self.remote_copy = os.environ.get('__remote_copy', "scp -o User=root -q")
|
self.remote_copy = os.environ.get('__remote_copy', "scp -o User=root -q")
|
||||||
self.remote = remote.Remote(self.target_host, self.remote_base_path,
|
self.remote = remote.Remote(self.target_host, self.remote_base_path,
|
||||||
self.remote_exec, self.remote_copy)
|
self.remote_exec, self.remote_copy)
|
||||||
|
|
||||||
def cleanup(self):
|
def cleanup(self):
|
||||||
|
|
|
@ -65,7 +65,7 @@ class Manifest(object):
|
||||||
def __init__(self, target_host, local):
|
def __init__(self, target_host, local):
|
||||||
self.target_host = target_host
|
self.target_host = target_host
|
||||||
self.local = local
|
self.local = local
|
||||||
|
|
||||||
self.log = logging.getLogger(self.target_host)
|
self.log = logging.getLogger(self.target_host)
|
||||||
|
|
||||||
self.env = {
|
self.env = {
|
||||||
|
|
|
@ -46,7 +46,7 @@ class Object(object):
|
||||||
"""Represents a cdist object.
|
"""Represents a cdist object.
|
||||||
|
|
||||||
All interaction with objects in cdist should be done through this class.
|
All interaction with objects in cdist should be done through this class.
|
||||||
Directly accessing an object through the file system from python code is
|
Directly accessing an object through the file system from python code is
|
||||||
a bug.
|
a bug.
|
||||||
|
|
||||||
"""
|
"""
|
||||||
|
|
|
@ -38,7 +38,7 @@ class Type(object):
|
||||||
"""Represents a cdist type.
|
"""Represents a cdist type.
|
||||||
|
|
||||||
All interaction with types in cdist should be done through this class.
|
All interaction with types in cdist should be done through this class.
|
||||||
Directly accessing an type through the file system from python code is
|
Directly accessing an type through the file system from python code is
|
||||||
a bug.
|
a bug.
|
||||||
|
|
||||||
"""
|
"""
|
||||||
|
|
|
@ -44,7 +44,7 @@ class Emulator(object):
|
||||||
self.object_source = os.environ['__cdist_manifest']
|
self.object_source = os.environ['__cdist_manifest']
|
||||||
self.target_host = os.environ['__target_host']
|
self.target_host = os.environ['__target_host']
|
||||||
self.type_base_path = os.environ['__cdist_type_base_path']
|
self.type_base_path = os.environ['__cdist_type_base_path']
|
||||||
|
|
||||||
self.object_base_path = os.path.join(self.global_path, "object")
|
self.object_base_path = os.path.join(self.global_path, "object")
|
||||||
|
|
||||||
self.type_name = os.path.basename(argv[0])
|
self.type_name = os.path.basename(argv[0])
|
||||||
|
@ -132,7 +132,7 @@ class Emulator(object):
|
||||||
for key,value in vars(self.args).items():
|
for key,value in vars(self.args).items():
|
||||||
if value is not None:
|
if value is not None:
|
||||||
self.parameters[key] = value
|
self.parameters[key] = value
|
||||||
|
|
||||||
if self.cdist_object.exists:
|
if self.cdist_object.exists:
|
||||||
if self.cdist_object.parameters != self.parameters:
|
if self.cdist_object.parameters != self.parameters:
|
||||||
raise cdist.Error("Object %s already exists with conflicting parameters:\n%s: %s\n%s: %s"
|
raise cdist.Error("Object %s already exists with conflicting parameters:\n%s: %s\n%s: %s"
|
||||||
|
|
|
@ -71,7 +71,7 @@ class Local(object):
|
||||||
self.object_path = os.path.join(self.out_path, "object")
|
self.object_path = os.path.join(self.out_path, "object")
|
||||||
|
|
||||||
self.log = logging.getLogger(self.target_host)
|
self.log = logging.getLogger(self.target_host)
|
||||||
|
|
||||||
def create_directories(self):
|
def create_directories(self):
|
||||||
self.mkdir(self.out_path)
|
self.mkdir(self.out_path)
|
||||||
self.mkdir(self.global_explorer_out_path)
|
self.mkdir(self.global_explorer_out_path)
|
||||||
|
@ -116,7 +116,7 @@ class Local(object):
|
||||||
self.log.debug("Local run script: %s", command)
|
self.log.debug("Local run script: %s", command)
|
||||||
if env:
|
if env:
|
||||||
self.log.debug("Local run script env: %s", env)
|
self.log.debug("Local run script env: %s", env)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
if return_output:
|
if return_output:
|
||||||
return subprocess.check_output(command, env=env).decode()
|
return subprocess.check_output(command, env=env).decode()
|
||||||
|
|
|
@ -69,7 +69,7 @@ class Remote(object):
|
||||||
self.global_explorer_path = os.path.join(self.conf_path, "explorer")
|
self.global_explorer_path = os.path.join(self.conf_path, "explorer")
|
||||||
|
|
||||||
self.log = logging.getLogger(self.target_host)
|
self.log = logging.getLogger(self.target_host)
|
||||||
|
|
||||||
def create_directories(self):
|
def create_directories(self):
|
||||||
self.rmdir(self.base_path)
|
self.rmdir(self.base_path)
|
||||||
self.mkdir(self.base_path)
|
self.mkdir(self.base_path)
|
||||||
|
@ -110,7 +110,7 @@ class Remote(object):
|
||||||
|
|
||||||
"""
|
"""
|
||||||
assert isinstance(command, (list, tuple)), "list or tuple argument expected, got: %s" % command
|
assert isinstance(command, (list, tuple)), "list or tuple argument expected, got: %s" % command
|
||||||
|
|
||||||
# can't pass environment to remote side, so prepend command with
|
# can't pass environment to remote side, so prepend command with
|
||||||
# variable declarations
|
# variable declarations
|
||||||
if env:
|
if env:
|
||||||
|
@ -151,7 +151,7 @@ class Remote(object):
|
||||||
self.log.debug("Remote run script: %s", command)
|
self.log.debug("Remote run script: %s", command)
|
||||||
if env:
|
if env:
|
||||||
self.log.debug("Remote run script env: %s", env)
|
self.log.debug("Remote run script env: %s", env)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
if return_output:
|
if return_output:
|
||||||
return subprocess.check_output(command).decode()
|
return subprocess.check_output(command).decode()
|
||||||
|
|
Loading…
Reference in a new issue