Skip to content
This repository has been archived by the owner on Jul 25, 2022. It is now read-only.

Commit

Permalink
Don't merge old bundles with new (#365)
Browse files Browse the repository at this point in the history
Fixes #360

There was a design committed to retire old bundles when upgrades
were done but this doesn't really work as designed since it
leaves agents pointing at repos that don't exist immediately
after the manager upgrade is completed.

Instead, empty the retired bundles but make them valid (but
empty) repos.

Signed-off-by: Brian J. Murrell <[email protected]>
  • Loading branch information
brianjmurrell authored and Joe Grund committed Oct 28, 2017
1 parent 15ec161 commit 9be942d
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
12 changes: 11 additions & 1 deletion chroma-bundles/install
Original file line number Diff line number Diff line change
Expand Up @@ -305,7 +305,7 @@ def _new_profiles(upgrade):
def _old_bundles():
bundles = {}
log.debug("Bundles currently installed:")
for bundle_meta_path in glob.glob(os.path.join(BUNDLE_ROOT, "*/meta")):
for bundle_meta_path in glob.glob(os.path.join(BUNDLE_ROOT, "*/*/meta")):
meta = json.load(open(bundle_meta_path))

log.debug("{name}-{version}: {description}".format(
Expand Down Expand Up @@ -449,6 +449,7 @@ def _backup_repo(old_bundles, bundle, meta):
# repos
if os.path.exists(os.path.join(BUNDLE_ROOT, meta['name'])):
for path in os.listdir(os.path.join(BUNDLE_ROOT, meta['name'])):
path = os.path.join(BUNDLE_ROOT, meta['name'], path)
if os.path.isdir(path):
shutil.rmtree(path)
else:
Expand Down Expand Up @@ -507,6 +508,15 @@ def _install_or_upgrade_bundles(old_bundles, new_bundles):
# repo will already have been moved to backup location
log.debug("Removing retired bundle %s" % meta['name'])
_run(['chroma-config', 'bundle', 'delete', install_location])
# agents will still have the repo we just deleted configured
# and be getting errors trying to find the metadata
# create an empty repo for this retired bundle
try:
os.makedirs(install_location)
except OSError as e:
if e.errno != errno.EEXIST:
raise SystemExit("Failed to create %s" % install_location)
_run(['createrepo', install_location])


def _install_or_upgrade_profiles(new_profiles):
Expand Down
1 change: 1 addition & 0 deletions chroma-manager/chroma-manager.spec
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ Requires: iml-supervisor-status
Requires: iml-gui
Requires: iml-srcmap-reverse
Requires: iml-online-help
Requires: createrepo
Conflicts: chroma-agent
Requires(post): selinux-policy-targeted
Obsoletes: httpd
Expand Down

0 comments on commit 9be942d

Please sign in to comment.