def test_determine_packages_newton(self, subcontext): self.os_release.return_value = 'newton' self.token_cache_pkgs.return_value = ['memcached'] pkgs = utils.determine_packages() ex = list( set(utils.BASE_PACKAGES + ['memcached'] + utils.BASE_SERVICES)) self.assertEqual(ex, pkgs)
def upgrade_charm(): apt_install(determine_packages(), fatal=True) if remove_old_packages(): log("Package purge detected, restarting services", "INFO") for s in services(): service_restart(s) if is_leader(): # if we are upgrading, then the old version might have used the # HEAT_PATH/encryption-key. So we grab the key from that, and put it in # leader settings to ensure that the key remains the same during an # upgrade. encryption_path = os.path.join(HEAT_PATH, 'encryption-key') if os.path.isfile(encryption_path): with open(encryption_path, 'r') as f: encryption_key = f.read() try: leader_set({'heat-auth-encryption-key': encryption_key}) except subprocess.CalledProcessError as e: log("upgrade: leader_set: heat-auth-encryption-key failed," " didn't delete the existing file: {}.\n" "Error was: ".format(encryption_path, str(e)), level=WARNING) else: # now we just delete the file os.remove(encryption_path) leader_elected()
def test_determine_packages_queens(self, subcontext): self.os_release.return_value = 'queens' self.token_cache_pkgs.return_value = ['python-memcache', 'memcached'] pkgs = utils.determine_packages() ex = list(set(utils.BASE_PACKAGES + ['python-memcache', 'memcached'] + utils.BASE_SERVICES)) self.assertEqual(sorted(ex), sorted(pkgs))
def test_determine_packages_rocky(self, subcontext): self.os_release.return_value = 'rocky' self.token_cache_pkgs.return_value = ['python-memcache', 'memcached'] pkgs = utils.determine_packages() ex = list(set( [p for p in utils.BASE_PACKAGES if not p.startswith('python-')] + ['memcached'] + utils.BASE_SERVICES + utils.PY3_PACKAGES)) self.assertEqual(sorted(ex), sorted(pkgs))
def install(): status_set('maintenance', 'Executing pre-install') execd_preinstall() configure_installation_source(config('openstack-origin')) status_set('maintenance', 'Installing apt packages') apt_update() apt_install(determine_packages(), fatal=True) _files = os.path.join(charm_dir(), 'files') if os.path.isdir(_files): for f in os.listdir(_files): f = os.path.join(_files, f) log('Installing {} to /usr/bin'.format(f)) shutil.copy2(f, '/usr/bin') for port in API_PORTS.values(): open_port(port)
def test_determine_packages(self, subcontext): self.os_release.return_value = 'havana' pkgs = utils.determine_packages() ex = list(set(utils.BASE_PACKAGES + utils.BASE_SERVICES)) self.assertEqual(ex, pkgs)
def test_determine_packages(self, subcontext): self.os_release.return_value = 'havana' pkgs = utils.determine_packages() ex = list(set(utils.BASE_PACKAGES + utils.BASE_SERVICES)) self.assertEquals(ex, pkgs)