Skip to content

Instantly share code, notes, and snippets.

@parthaa
Created April 7, 2021 13:36
Show Gist options
  • Save parthaa/242f3084aba33088929ab56ede2e2d71 to your computer and use it in GitHub Desktop.
Save parthaa/242f3084aba33088929ab56ede2e2d71 to your computer and use it in GitHub Desktop.
#!/bin/bash
shopt -s expand_aliases
set -e
set -x
EXPORT_ORG="export-$RANDOM"
PRODUCT="prod"
REPO1="katello"
REPO1_URL="https://fedorapeople.org/groups/katello/releases/yum/3.8/katello/el7/x86_64/"
REPO2="misc"
REPO2_URL="https://fixtures.pulpproject.org/rpm-with-modules/"
REPO3="candlepin"
REPO3_URL="https://fedorapeople.org/groups/katello/releases/yum/3.8/candlepin/el7/x86_64/"
REPO4="file"
REPO4_URL="https://fixtures.pulpproject.org/file/"
CONTENT_VIEW="view"
# create import export orgs
hammer organization create --name=$EXPORT_ORG
#create the products in both import and export orgs
hammer product create --name=$PRODUCT --organization=$EXPORT_ORG
#create and sync repositories in export org
hammer repository create --content-type=yum --product=$PRODUCT --name=$REPO1 --url=$REPO1_URL --organization=$EXPORT_ORG
hammer repository create --content-type=yum --product=$PRODUCT --name=$REPO2 --url=$REPO2_URL --organization=$EXPORT_ORG
hammer repository create --content-type=yum --product=$PRODUCT --name=$REPO3 --url=$REPO3_URL --organization=$EXPORT_ORG
hammer repository create --content-type=file --product=$PRODUCT --name=$REPO4 --url=$REPO4_URL --organization=$EXPORT_ORG
hammer repository synchronize --product=$PRODUCT --name=$REPO1 --organization=$EXPORT_ORG
hammer repository synchronize --product=$PRODUCT --name=$REPO2 --organization=$EXPORT_ORG
hammer repository synchronize --product=$PRODUCT --name=$REPO3 --organization=$EXPORT_ORG
hammer repository synchronize --product=$PRODUCT --name=$REPO4 --organization=$EXPORT_ORG
# create content view in EXPORT_ORG
hammer content-view create --name=$CONTENT_VIEW --organization=$EXPORT_ORG
hammer content-view add-repository --name=$CONTENT_VIEW --repository=$REPO3 --product=$PRODUCT --organization=$EXPORT_ORG
hammer content-view add-repository --name=$CONTENT_VIEW --repository=$REPO2 --product=$PRODUCT --organization=$EXPORT_ORG
hammer content-view publish --name=$CONTENT_VIEW --organization=$EXPORT_ORG
hammer content-view add-repository --name=$CONTENT_VIEW --repository=$REPO1 --product=$PRODUCT --organization=$EXPORT_ORG
hammer content-view publish --name=$CONTENT_VIEW --organization=$EXPORT_ORG
hammer content-view remove-repository --name=$CONTENT_VIEW --repository=$REPO3 --product=$PRODUCT --organization=$EXPORT_ORG
hammer content-view remove-repository --name=$CONTENT_VIEW --repository=$REPO2 --product=$PRODUCT --organization=$EXPORT_ORG
hammer content-view publish --name=$CONTENT_VIEW --organization=$EXPORT_ORG
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment