示例#1
0
    def setUp(self):
        self.local_dir = self.mkdtemp()
        self.hostdir = cdist.str_hash(self.target_host[0])
        self.host_base_path = os.path.join(self.local_dir, self.hostdir)

        self.local = local.Local(target_host=self.target_host,
                                 target_host_tags=self.target_host_tags,
                                 base_root_path=self.host_base_path,
                                 host_dir_name=self.hostdir,
                                 exec_path=cdist.test.cdist_exec_path,
                                 add_conf_dirs=[conf_dir])
        self.local.create_files_dirs()

        self.remote_dir = self.mkdtemp()
        remote_exec = self.remote_exec
        remote_copy = self.remote_copy
        self.remote = remote.Remote(target_host=self.target_host,
                                    remote_exec=remote_exec,
                                    remote_copy=remote_copy,
                                    base_path=self.remote_dir)
        self.remote.create_files_dirs()

        self.code = code.Code(self.target_host, self.local, self.remote)

        self.cdist_type = core.CdistType(self.local.type_path,
                                         '__dump_environment')
        self.cdist_object = core.CdistObject(self.cdist_type,
                                             self.local.object_path,
                                             'whatever',
                                             self.local.object_marker_name)
        self.cdist_object.create()
示例#2
0
文件: __init__.py 项目: evax/cdist
    def setUp(self):
        self.target_host = 'localhost'

        self.local_base_path = local_base_path
        self.out_path = self.mkdtemp()
        self.local = local.Local(self.target_host, self.local_base_path,
                                 self.out_path)
        self.local.create_directories()

        self.remote_base_path = self.mkdtemp()
        self.user = getpass.getuser()
        remote_exec = "ssh -o User=%s -q" % self.user
        remote_copy = "scp -o User=%s -q" % self.user
        self.remote = remote.Remote(self.target_host, self.remote_base_path,
                                    remote_exec, remote_copy)

        self.code = code.Code(self.target_host, self.local, self.remote)

        self.cdist_type = core.CdistType(self.local.type_path,
                                         '__dump_environment')
        self.cdist_object = core.CdistObject(self.cdist_type,
                                             self.local.object_path,
                                             'whatever')
        self.cdist_object.create()

        self.log = logging.getLogger("cdist")
示例#3
0
    def setUp(self):
        self.local_dir = self.mkdtemp()

        self.local = local.Local(target_host=self.target_host,
                                 base_path=self.local_dir,
                                 exec_path=cdist.test.cdist_exec_path,
                                 add_conf_dirs=[conf_dir])
        self.local.create_files_dirs()

        self.remote_dir = self.mkdtemp()
        remote_exec = self.remote_exec
        remote_copy = self.remote_copy
        self.remote = remote.Remote(target_host=self.target_host,
                                    remote_exec=remote_exec,
                                    remote_copy=remote_copy,
                                    base_path=self.remote_dir)
        self.remote.create_files_dirs()

        self.code = code.Code(self.target_host, self.local, self.remote)

        self.cdist_type = core.CdistType(self.local.type_path,
                                         '__dump_environment')
        self.cdist_object = core.CdistObject(self.cdist_type,
                                             self.local.object_path,
                                             'whatever')
        self.cdist_object.create()
示例#4
0
文件: __init__.py 项目: zakkg3/cdist
    def setUp(self):
        # logging.root.setLevel(logging.TRACE)
        save_output_streams = False
        self.temp_dir = self.mkdtemp()

        self.local_dir = os.path.join(self.temp_dir, "local")
        self.hostdir = cdist.str_hash(self.target_host[0])
        self.host_base_path = os.path.join(self.local_dir, self.hostdir)
        os.makedirs(self.host_base_path)
        self.local = local.Local(target_host=self.target_host,
                                 target_host_tags=None,
                                 base_root_path=self.host_base_path,
                                 host_dir_name=self.hostdir,
                                 exec_path=cdist.test.cdist_exec_path,
                                 add_conf_dirs=[conf_dir],
                                 save_output_streams=save_output_streams)
        self.local.create_files_dirs()

        self.remote_dir = self.mkdtemp()
        remote_exec = self.remote_exec
        remote_copy = self.remote_copy
        self.remote = remote.Remote(
            target_host=self.target_host,
            remote_exec=remote_exec,
            remote_copy=remote_copy,
            base_path=self.remote_dir,
            stdout_base_path=self.local.stdout_base_path,
            stderr_base_path=self.local.stderr_base_path,
            save_output_streams=save_output_streams)
        self.remote.create_files_dirs()

        self.code = code.Code(self.target_host, self.local, self.remote)

        self.manifest = manifest.Manifest(self.target_host, self.local)

        self.cdist_type = core.CdistType(self.local.type_path,
                                         '__write_to_stdout_and_stderr')
        self.cdist_object = core.CdistObject(self.cdist_type,
                                             self.local.object_path,
                                             self.local.object_marker_name, '')
        self.cdist_object.create()
        self.output_dirs = {
            'object': {
                'stdout': os.path.join(self.cdist_object.absolute_path,
                                       'stdout'),
                'stderr': os.path.join(self.cdist_object.absolute_path,
                                       'stderr'),
            },
            'init': {
                'stdout': os.path.join(self.local.base_path, 'stdout'),
                'stderr': os.path.join(self.local.base_path, 'stderr'),
            },
        }