def post_install(self): """Post installation steps.""" logger.debug("post_install") if self.do_server: self._set_cell_config(self.dirs['AFS_CONF_DIR'], self.cell, self.cellhosts) self._set_krb_config(self.dirs['AFS_CONF_DIR'], self.cell, self.realm) if self.do_client: # Create the CellServDB and ThisCell files. Remove any symlinks that # may have been created by the bosserver. Combine the optional CellServDB.dist # to access other cells. csdb = os.path.join(self.dirs['AFS_DATA_DIR'], "CellServDB") local = os.path.join(self.dirs['AFS_DATA_DIR'], "CellServDB.local") dist = os.path.join(self.dirs['AFS_DATA_DIR'], "CellServDB.dist") self._set_cell_config(self.dirs['AFS_DATA_DIR'], self.cell, self.cellhosts, ext=".local") if self.csdb: shutil.copyfile(self.csdb, dist) else: touch(dist) cat([local, dist], csdb) # Set the cache info parameters. # XXX: size should be calculated from partition, if mounted. cache_size = 102000 # k blocks self._set_cache_info( self.dirs['AFS_DATA_DIR'], self.dirs['AFS_MOUNT_DIR'], self.dirs['AFS_CACHE_DIR'], cache_size) if self.scripts['post_install']: logger.info("Running post-install script.") args = shlex.split(self.scripts['post_install']) sh(*args, output=False)
def test_touch(self): tdir = tempfile.mkdtemp() src = os.path.join(tdir, "xyzzy") try: touch(src) finally: shutil.rmtree(tdir)
def _make_vice_dirs(self): """Create test vice directories.""" parts = ('a', 'b') vicedirs = ['/vicep'+p for p in parts] for path in vicedirs: if not os.path.exists(path): logger.info("Making vice partition '%s'.", path) os.mkdir(path) touch(os.path.join(path, "AlwaysAttach")) touch(os.path.join(path, "PURGE_VOLUMES"))
def test_symlink(self): tdir = tempfile.mkdtemp() src = os.path.join(tdir, "xyzzy") dst = os.path.join(tdir, "plugh") try: touch(src) symlink(src, dst) self.assertTrue(os.path.exists(dst)) self.assertTrue(os.path.islink(dst)) finally: shutil.rmtree(tdir)
def test_so_symlinks(self): from afsutil.system.sunos import _so_symlinks tdir = tempfile.mkdtemp() src = os.path.join(tdir, "xyzzy.so.1.0.0") try: touch(src) _so_symlinks(tdir) self.assertTrue(os.path.islink(os.path.join(tdir, "xyzzy.so.1.0"))) self.assertTrue(os.path.islink(os.path.join(tdir, "xyzzy.so.1"))) self.assertTrue(os.path.islink(os.path.join(tdir, "xyzzy.so"))) finally: shutil.rmtree(tdir)