def setUp(self): self.opts = _config = minion_config(None) self.tmp_dir = tempfile.mkdtemp(dir=tests.integration.TMP) os.makedirs(self.module_dir) self.lib_count = collections.defaultdict( int) # mapping of path -> count # bootstrap libs with open(os.path.join(self.module_dir, '__init__.py'), 'w') as fh: fh.write(deep_init_base) fh.flush() os.fsync(fh.fileno()) # flush to disk self.lib_paths = {} dir_path = self.module_dir for lib_name in self.libs: dir_path = os.path.join(dir_path, lib_name) self.lib_paths[lib_name] = dir_path os.makedirs(dir_path) self.update_lib(lib_name) dirs = _module_dirs(self.opts, 'modules', 'module') dirs.append(self.tmp_dir) self.utils = utils(self.opts) self.proxy = proxy(self.opts) self.minion_mods = minion_mods(self.opts) self.loader = LazyLoader(dirs, self.opts, tag='module', pack={ '__utils__': self.utils, '__proxy__': self.proxy, '__salt__': self.minion_mods })
def setUp(self): self.opts = _config = minion_config(None) self.tmp_dir = tempfile.mkdtemp(dir=integration.TMP) os.makedirs(self.module_dir) self.lib_count = collections.defaultdict(int) # mapping of path -> count # bootstrap libs with open(os.path.join(self.module_dir, '__init__.py'), 'w') as fh: # No .decode() needed here as deep_init_base is defined as str and # not bytes. fh.write(deep_init_base) fh.flush() os.fsync(fh.fileno()) # flush to disk self.lib_paths = {} dir_path = self.module_dir for lib_name in self.libs: dir_path = os.path.join(dir_path, lib_name) self.lib_paths[lib_name] = dir_path os.makedirs(dir_path) self.update_lib(lib_name) dirs = _module_dirs(self.opts, 'modules', 'module') dirs.append(self.tmp_dir) self.utils = utils(self.opts) self.proxy = proxy(self.opts) self.minion_mods = minion_mods(self.opts) self.loader = LazyLoader(dirs, self.opts, tag='module', pack={'__utils__': self.utils, '__proxy__': self.proxy, '__salt__': self.minion_mods} )
def setUp(self): self.tmp_dir = tempfile.mkdtemp(dir=TMP) opts = copy.deepcopy(self.opts) dirs = _module_dirs(opts, 'modules', 'module') dirs.append(self.tmp_dir) self.utils = utils(opts) self.proxy = proxy(opts) self.minion_mods = minion_mods(opts) self.loader = LazyLoader(dirs, opts, tag='module', pack={'__utils__': self.utils, '__proxy__': self.proxy, '__salt__': self.minion_mods})
def setUp(self): self.opts = _config = minion_config(None) self.opts['grains'] = grains(self.opts) self.tmp_dir = tempfile.mkdtemp(dir=integration.TMP) dirs = _module_dirs(self.opts, 'modules', 'module') dirs.append(self.tmp_dir) self.utils = utils(self.opts) self.proxy = proxy(self.opts) self.minion_mods = minion_mods(self.opts) self.loader = LazyLoader(dirs, self.opts, tag='module', pack={'__utils__': self.utils, '__proxy__': self.proxy, '__salt__': self.minion_mods})
def setUp(self): self.opts = _config = minion_config(None) self.opts['grains'] = grains(self.opts) self.tmp_dir = tempfile.mkdtemp(dir=integration.TMP) self.count = 0 dirs = _module_dirs(self.opts, 'modules', 'module') dirs.append(self.tmp_dir) self.utils = utils(self.opts) self.proxy = proxy(self.opts) self.minion_mods = minion_mods(self.opts) self.loader = LazyLoader(dirs, self.opts, tag='module', pack={'__utils__': self.utils, '__proxy__': self.proxy, '__salt__': self.minion_mods})
def setUp(self): self.tmp_dir = tempfile.mkdtemp(dir=TMP) os.makedirs(self.module_dir) self.lib_count = collections.defaultdict( int) # mapping of path -> count # bootstrap libs with salt.utils.files.fopen( os.path.join(self.module_dir, '__init__.py'), 'w') as fh: # No .decode() needed here as deep_init_base is defined as str and # not bytes. fh.write( salt.utils.stringutils.to_str( deep_init_base.format(self.module_name))) fh.flush() os.fsync(fh.fileno()) # flush to disk self.lib_paths = {} dir_path = self.module_dir for lib_name in self.libs: dir_path = os.path.join(dir_path, lib_name) self.lib_paths[lib_name] = dir_path os.makedirs(dir_path) self.update_lib(lib_name) opts = copy.deepcopy(self.opts) dirs = _module_dirs(opts, 'modules', 'module') dirs.append(self.tmp_dir) self.utils = utils(opts) self.proxy = proxy(opts) self.minion_mods = minion_mods(opts) self.loader = LazyLoader(dirs, copy.deepcopy(opts), tag='module', pack={ '__utils__': self.utils, '__proxy__': self.proxy, '__salt__': self.minion_mods }) self.assertIn('{0}.top'.format(self.module_name), self.loader)