Skip to content

Instantly share code, notes, and snippets.

@jturel
Created August 2, 2019 18:03
Show Gist options
  • Save jturel/dc9e405cb0930e429cf7ce7e76ff238d to your computer and use it in GitHub Desktop.
Save jturel/dc9e405cb0930e429cf7ce7e76ff238d to your computer and use it in GitHub Desktop.
generate and import a manifest into local candlepin
in the console:
# find library environment of default org
environment_id = Katello::ContentViewEnvironment.first.cp_id
# create the consumer in the environment
consumer = Katello::Resources::Candlepin::Consumer.create(environment_id, {name: "you-will-export-me", type: {"label": "candlepin"}}, [])
# export the consumer's manifest to a .zip
data = Katello::Resources::Candlepin::CandlepinResource.get("/candlepin/consumers/#{consumer['uuid']}/export")
# write manifest data to file
manifest = Tempfile.new('/tmp/manifest.zip').binmode
manifest.write(data)
at the shell:
# import it with hammer to the destination org:
hammer subscription upload --file tmpmanifest.zip20190802-16595-h827ol --organization-label=ImportOrg
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment