forked from ungleich-public/cdist
Merge branch 'lint/py3-classes' into 'master'
Consequently use Python 3-style classes See merge request ungleich-public/cdist!898
This commit is contained in:
commit
d478bef8a6
18 changed files with 19 additions and 22 deletions
|
@ -71,7 +71,7 @@ def _graph_dfs_cycle(graph, node, path):
|
|||
return False
|
||||
|
||||
|
||||
class Config(object):
|
||||
class Config:
|
||||
"""Cdist main class to hold arbitrary data"""
|
||||
|
||||
# list of paths (files and/or directories) that will be removed on finish
|
||||
|
|
|
@ -47,7 +47,7 @@ class MissingObjectIdError(cdist.Error):
|
|||
return '%s' % (self.message)
|
||||
|
||||
|
||||
class CdistObject(object):
|
||||
class CdistObject:
|
||||
"""Represents a cdist object.
|
||||
|
||||
All interaction with objects in cdist should be done through this class.
|
||||
|
|
|
@ -38,7 +38,7 @@ class InvalidTypeError(cdist.Error):
|
|||
self.type_path, self.type_absolute_path, self.source_path)
|
||||
|
||||
|
||||
class CdistType(object):
|
||||
class CdistType:
|
||||
"""Represents a cdist type.
|
||||
|
||||
All interaction with types in cdist should be done through this class.
|
||||
|
|
|
@ -92,7 +92,7 @@ code-remote
|
|||
'''
|
||||
|
||||
|
||||
class Code(object):
|
||||
class Code:
|
||||
"""Generates and executes cdist code scripts.
|
||||
|
||||
"""
|
||||
|
|
|
@ -63,7 +63,7 @@ type explorer is:
|
|||
'''
|
||||
|
||||
|
||||
class Explorer(object):
|
||||
class Explorer:
|
||||
"""Executes cdist explorers.
|
||||
|
||||
"""
|
||||
|
|
|
@ -92,7 +92,7 @@ class NoInitialManifestError(cdist.Error):
|
|||
return repr(self.message)
|
||||
|
||||
|
||||
class Manifest(object):
|
||||
class Manifest:
|
||||
"""Executes cdist manifests.
|
||||
|
||||
"""
|
||||
|
|
|
@ -56,7 +56,7 @@ class DefaultList(list):
|
|||
return cls(initial.split('\n'))
|
||||
|
||||
|
||||
class Emulator(object):
|
||||
class Emulator:
|
||||
def __init__(self, argv, stdin=sys.stdin.buffer, env=os.environ):
|
||||
self.argv = argv
|
||||
self.stdin = stdin
|
||||
|
|
|
@ -39,7 +39,7 @@ import cdist.exec.util as util
|
|||
CONF_SUBDIRS_LINKED = ["explorer", "files", "manifest", "type", ]
|
||||
|
||||
|
||||
class Local(object):
|
||||
class Local:
|
||||
"""Execute commands locally.
|
||||
|
||||
All interaction with the local side should be done through this class.
|
||||
|
|
|
@ -49,7 +49,7 @@ class DecodeError(cdist.Error):
|
|||
return "Cannot decode output of " + " ".join(self.command)
|
||||
|
||||
|
||||
class Remote(object):
|
||||
class Remote:
|
||||
"""Execute commands remotely.
|
||||
|
||||
All interaction with the remote side should be done through this class.
|
||||
|
|
|
@ -41,7 +41,7 @@ def hostfile_process_line(line, strip_func=str.strip):
|
|||
return None
|
||||
|
||||
|
||||
class HostSource(object):
|
||||
class HostSource:
|
||||
"""
|
||||
Host source object.
|
||||
Source can be a sequence or filename (stdin if \'-\').
|
||||
|
|
|
@ -28,8 +28,7 @@ import glob
|
|||
import fnmatch
|
||||
|
||||
|
||||
class Info(object):
|
||||
|
||||
class Info:
|
||||
def __init__(self, conf_dirs, args):
|
||||
self.conf_dirs = conf_dirs
|
||||
self.all = args.all
|
||||
|
|
|
@ -79,7 +79,7 @@ def rstrip_nl(s):
|
|||
return str.rstrip(s, "\n")
|
||||
|
||||
|
||||
class Inventory(object):
|
||||
class Inventory:
|
||||
"""Inventory main class"""
|
||||
|
||||
def __init__(self, db_basedir=dist_inventory_db, configuration=None):
|
||||
|
|
|
@ -27,7 +27,7 @@ import tempfile
|
|||
log = logging.getLogger(__name__)
|
||||
|
||||
|
||||
class Message(object):
|
||||
class Message:
|
||||
"""Support messaging between types
|
||||
|
||||
"""
|
||||
|
|
|
@ -78,7 +78,7 @@ def get_available_preoses_string(cls):
|
|||
return "Available PreOS-es:\n{}".format("\n".join(preoses))
|
||||
|
||||
|
||||
class PreOS(object):
|
||||
class PreOS:
|
||||
preoses = None
|
||||
|
||||
@classmethod
|
||||
|
|
|
@ -30,7 +30,7 @@ import os
|
|||
import subprocess
|
||||
|
||||
|
||||
class Debian(object):
|
||||
class Debian:
|
||||
_preos_name = 'debian'
|
||||
_cdist_preos = True
|
||||
|
||||
|
|
|
@ -32,10 +32,8 @@ import cdist.config
|
|||
log = logging.getLogger(__name__)
|
||||
|
||||
|
||||
class Shell(object):
|
||||
|
||||
class Shell:
|
||||
def __init__(self, shell=None):
|
||||
|
||||
self.shell = shell
|
||||
|
||||
self.target_host = (
|
||||
|
|
|
@ -44,7 +44,7 @@ expected_object_names = sorted([
|
|||
'__third/moon'])
|
||||
|
||||
|
||||
class CdistObjectErrorContext(object):
|
||||
class CdistObjectErrorContext:
|
||||
def __init__(self, original_error):
|
||||
self.original_error = original_error
|
||||
|
||||
|
|
|
@ -177,7 +177,7 @@ class DirectoryDict(collections.MutableMapping):
|
|||
raise cdist.Error(str(e))
|
||||
|
||||
|
||||
class FileBasedProperty(object):
|
||||
class FileBasedProperty:
|
||||
attribute_class = None
|
||||
|
||||
def __init__(self, path):
|
||||
|
@ -189,7 +189,7 @@ class FileBasedProperty(object):
|
|||
|
||||
Usage with a sublcass:
|
||||
|
||||
class Foo(object):
|
||||
class Foo:
|
||||
# note that the actual DirectoryDict is stored as __parameters
|
||||
# on the instance
|
||||
parameters = DirectoryDictProperty(
|
||||
|
|
Loading…
Reference in a new issue