Updating so we don't try to update git repos if they exist, leaving them alone

Updating so that we don't uninstall python packages if keep old
This commit is contained in:
Joshua Harlow 2012-03-29 12:31:39 -07:00
parent 28b1068d7d
commit 79104bc3a8
6 changed files with 17 additions and 20 deletions

@ -13,7 +13,6 @@ commands:
git:
checkout: git checkout
clone: git clone
pull: git pull
libvirt:
restart: service libvirtd restart
status: service libvirtd status

@ -14,7 +14,6 @@ commands:
git:
checkout: git checkout
clone: git clone
pull: git pull
libvirt:
restart: service libvirtd restart
status: service libvirtd status

@ -14,7 +14,6 @@ commands:
git:
checkout: git checkout
clone: git clone
pull: git pull
iscsi:
restart: service tgt restart
start: service tgt start

@ -469,14 +469,16 @@ class PkgUninstallComponent(ComponentBase, PackageBasedComponentMixin):
dirs_made = [sh.abspth(d) for d in dirs_made]
if self.keep_old:
download_places = [path_location[0] for path_location in self.tracereader.download_locations()]
utils.log_iterable(download_places, logger=LOG,
header="Keeping %s download directories" % (len(download_places)))
for download_place in download_places:
dirs_made = sh.remove_parents(download_place, dirs_made)
utils.log_iterable(dirs_made, logger=LOG,
header="Removing %s created directories" % (len(dirs_made)))
for dir_name in dirs_made:
sh.deldir(dir_name, run_as_root=True)
if download_places:
utils.log_iterable(download_places, logger=LOG,
header="Keeping %s download directories (and there children directories)" % (len(download_places)))
for download_place in download_places:
dirs_made = sh.remove_parents(download_place, dirs_made)
if dirs_made:
utils.log_iterable(dirs_made, logger=LOG,
header="Removing %s created directories" % (len(dirs_made)))
for dir_name in dirs_made:
sh.deldir(dir_name, run_as_root=True)
class PythonUninstallComponent(PkgUninstallComponent):
@ -489,6 +491,9 @@ class PythonUninstallComponent(PkgUninstallComponent):
PkgUninstallComponent.uninstall(self)
def _uninstall_pips(self):
if self.keep_old:
LOG.info('Keep-old flag set, not removing any python packages.')
return
pips = self.tracereader.pips_installed()
if pips:
pip_names = set([p['name'] for p in pips])

@ -126,7 +126,7 @@ class KeystoneInstaller(comp.PythonInstallComponent):
db.create_db(self.cfg, self.pw_gen, self.distro, DB_NAME)
def _setup_initer(self):
LOG.info("Configuring keystone initializer template %s.", MANAGE_DATA_CONF)
LOG.info("Configuring keystone initializer template %r", MANAGE_DATA_CONF)
(_, contents) = utils.load_template(self.component_name, MANAGE_DATA_CONF)
mp = self._get_param_map(MANAGE_DATA_CONF)
contents = utils.param_replace(contents, mp, True)

@ -48,20 +48,15 @@ class GitDownloader(Downloader):
def download(self):
dirsmade = list()
if sh.isdir(self.store_where):
LOG.info("Updating using git: located at %r" % (self.store_where))
cmd = list(self.distro.get_command('git', 'checkout'))
cmd += [GIT_MASTER_BRANCH]
sh.execute(*cmd, cwd=self.store_where)
cmd = self.distro.get_command('git', 'pull')
sh.execute(*cmd, cwd=self.store_where)
LOG.info("Existing directory located at %r, leaving it alone." % (self.store_where))
else:
LOG.info("Downloading using git: %r to %r" % (self.uri, self.store_where))
LOG.info("Downloading %r to %r" % (self.uri, self.store_where))
dirsmade.extend(sh.mkdirslist(self.store_where))
cmd = list(self.distro.get_command('git', 'clone'))
cmd += [self.uri, self.store_where]
sh.execute(*cmd)
if self.branch and self.branch != GIT_MASTER_BRANCH:
LOG.info("Adjusting branch using git: %r" % (self.branch))
LOG.info("Adjusting branch to %r" % (self.branch))
cmd = list(self.distro.get_command('git', 'checkout'))
cmd += [self.branch]
sh.execute(*cmd, cwd=self.store_where)