def install_repos(self): sources = glob.glob(self.host_system_config['repos']['src']) for source in sources: destination = os.path.join( self.host_system_config['repos']['dst'], os.path.basename(source)) utils.copy(source, destination)
def copy_repo(self): """Copy centos repo on the host system. We need to make sure that when user removes temporary files after upgrade his repo path is valid. """ utils.copy(self.repo_src, self.repo_dst)
def run(self): """Install patched manifests to the master node.""" for srcpath, dstpath in self._copypairs: # we can't just copy folder as is, since it's not a full and # overwrite mode will erase entire old content for srcfile in iterfiles(srcpath): copy(srcfile, srcfile.replace(srcpath, dstpath))
def install_puppets(self): logger.info('Installing puppet manifests...') sources = glob.glob(self.config.openstack['puppets']['src']) for source in sources: destination = os.path.join(self.config.openstack['puppets']['dst'], os.path.basename(source)) utils.copy(source, destination)
def run(self): """Install patched manifests to the master node. """ for srcpath, dstpath in self._copypairs: # we can't just copy folder as is, since it's not a full and # overwrite mode will erase entire old content for srcfile in iterfiles(srcpath): copy(srcfile, srcfile.replace(srcpath, dstpath))
def install_repos(self): logger.info('Installing repositories...') sources = glob.glob(self.config.openstack['repos']['src']) for source in sources: destination = os.path.join(self.config.openstack['repos']['dst'], os.path.basename(source)) utils.copy(source, destination)
def install_repos(self): logger.info('Installing repositories...') sources = glob.glob(self.config.openstack['repos']['src']) for source in sources: destination = os.path.join( self.config.openstack['repos']['dst'], os.path.basename(source)) utils.copy(source, destination)
def install_puppets(self): logger.info('Installing puppet manifests...') sources = glob.glob(self.config.openstack['puppets']['src']) for source in sources: destination = os.path.join( self.config.openstack['puppets']['dst'], os.path.basename(source)) utils.copy(source, destination)
def install_versions(self): """Copy openstack release versions""" logger.info('Copy openstack release versions...') release_versions_cfg = self.config.openstack['release_versions'] versions = glob.glob(release_versions_cfg['src']) utils.create_dir_if_not_exists(release_versions_cfg['dst']) for version_file in versions: dst = os.path.join( release_versions_cfg['dst'], os.path.basename(version_file)) utils.copy(version_file, dst)
def install_versions(self): """Copy openstack release versions """ logger.info('Copy openstack release versions...') release_versions_cfg = self.config.openstack['release_versions'] versions = glob.glob(release_versions_cfg['src']) utils.create_dir_if_not_exists(release_versions_cfg['dst']) for version_file in versions: dst = os.path.join(release_versions_cfg['dst'], os.path.basename(version_file)) utils.copy(version_file, dst)
def switch_version_to_new(self): """Switches version.yaml file to new version * creates new version yaml file * and creates symlink to /etc/fuel/version.yaml """ logger.info(u'Run post upgrade actions') version_yaml_from_upgrade = self.config.new_upgrade_version_path new_version_path = self.config.new_version_path utils.create_dir_if_not_exists(os.path.dirname(new_version_path)) utils.copy(version_yaml_from_upgrade, new_version_path) utils.symlink(new_version_path, self.config.current_fuel_version_path)
def switch_to_new(self): """Switche version file to new version * creates new version yaml file * and creates symlink to /etc/fuel/version.yaml """ logger.info('Switch version file to new version') utils.create_dir_if_not_exists(os.path.dirname( self.dst_new_version_file)) utils.copy( self.src_new_version_file, self.dst_new_version_file) utils.symlink( self.dst_new_version_file, self.current_version_file)
def run(self): """Copy new yum.rb provider for both 5.0 and 5.0.1 releases. There are two installation strategies based on master node state: * We need to install for both 5.0 and 5.0.1 puppets in case of upgraded state (5.0 -> 5.0.1). * We need to install just one file in default location in case of pure state (previous installation was fresh). """ if not os.path.exists(os.path.join(self.puppet, '5.0.1')): # ok, we are in a pure state: either 5.0 or 5.0.1 copy( os.path.join( self.config.update_path, self.yum_providers[self.config.from_version]), os.path.join( self.puppet, self.destination), overwrite=True) else: # we aren't in a pure state, so we should install yum.rb for # both 5.0 and 5.0.1 puppets copy( os.path.join( self.config.update_path, self.yum_providers['5.0']), os.path.join( self.puppet, self.destination), overwrite=True) copy( os.path.join( self.config.update_path, self.yum_providers['5.0.1']), os.path.join( self.puppet, '5.0.1', self.destination), overwrite=True)
def test_copy_with_file(self, copy_mock, _): from_path = '/from_path' to_path = '/to_path' utils.copy(from_path, to_path) copy_mock.assert_called_once_with(from_path, to_path, True)
def do(self): copy(self._from, self._to, self._overwrite, self._symlinks)
def run(self): utils.copy(self._save_from, self._save_to, overwrite=True) # make sure that the file is still executable st = os.stat(self._save_to) os.chmod(self._save_to, st.st_mode | stat.S_IEXEC)