Skip to content

Embed URL

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Script to create an Organization with custom providers, users and roles.
#!/bin/bash -x
function kk() {
KATELLO_PATH=/usr/bin/katello
user=$1
password=$2
shift 2
date && $KATELLO_PATH -u $user -p $password "$@"
}
# Fetch fake dummy GPG key
wget https://raw.github.com/gist/3667453/0046825fdeb4c75bb563e2434ccab4617054654b/dummy.gpg
# Create i18n org and products
kk admin admin user create --username "Mane" --password redhat --email "mane@somecorp.com"
kk admin admin user assign_role --username "Mane" --role "Administrator"
kk Mane redhat org create --name "São Paulo" --label saopaulo
kk Mane redhat environment create --name "Xingú" --label xingu --prior Library --org "São Paulo"
kk Mane redhat provider create --name São_Paulo_prov --org "São Paulo"
kk Mane redhat product create --name São_Paulo_prod --label saopaulo_product --provider São_Paulo_prov --org "São Paulo"
kk Mane redhat repo create --name Zoológico --label zoologico --url http://tstrachota.fedorapeople.org/dummy_repos/zoo/ --product São_Paulo_prod --org "São Paulo"
kk Mane redhat provider synchronize --name São_Paulo_prov --org "São Paulo"
katello -u admin -p admin org create --name Tupinambá
katello -u admin -p admin environment create --name Mild --prior Library --org Tupinambá
katello -u admin -p admin provider create --name Animals --org Tupinambá
katello -u admin -p admin product create --name Zoo --provider Animals --org Tupinambá
katello -u admin -p admin repo create --name Animals1 --url http://omaciel.fedorapeople.org/fakerepo01/ --product Zoo --org Tupinambá
katello -u admin -p admin repo create --name Pererê --url http://omaciel.fedorapeople.org/fakerepo01/ --product Zoo --org Tupinambá
katello -u admin -p admin provider synchronize --name Animals --org Tupinambá
# Create the QE organization and environments
kk admin admin org create --name QE
kk admin admin environment create --name DEV --prior Library --org QE
kk admin admin environment create --name QE --prior DEV --org QE
kk admin admin environment create --name GA --prior QE --org QE
kk admin admin provider create --name Community --org QE
kk admin admin product create --name Nightly --provider Community --org QE
kk admin admin repo create --name Katello --url "http://fedorapeople.org/groups/katello/releases/yum/nightly/RHEL/6Server/x86_64/" --product Nightly --org QE
kk admin admin repo create --name Pulp --url "http://fedorapeople.org/groups/katello/releases/yum/katello-pulp/RHEL/6Server/x86_64/" --product Nightly --org QE
kk admin admin repo create --name Candlepin --url "http://fedorapeople.org/groups/katello/releases/yum/katello-candlepin/RHEL/6Server/x86_64/" --product Nightly --org QE
kk admin admin repo create --name Foreman --url "http://fedorapeople.org/groups/katello/releases/yum/katello-foreman/RHEL/6Server/x86_64/" --product Nightly --org QE
kk admin admin provider create --name Generic --org QE
kk admin admin product create --name Dependencies --provider Generic --org QE
kk admin admin repo create --name Epel --url "http://ftp.osuosl.org/pub/fedora-epel/6/x86_64/" --product Dependencies --org QE
kk admin admin provider synchronize --name="Community" --org QE
kk admin admin provider synchronize --name="Generic" --org QE
kk admin admin changeset create --name promote01 --environment DEV --org QE
kk admin admin changeset update --name promote01 --environment DEV --org QE --add_product Nightly
kk admin admin changeset update --name promote01 --environment DEV --org QE --add_product Dependencies
kk admin admin changeset apply --name promote01 --environment DEV --org QE
kk admin admin sync_plan create --org QE --interval daily --date `date +"%Y-%m-%d"` --time "06:00:00" --name "Testing Daily"
kk admin admin product set_plan --org QE --name "Nightly" --plan "Testing Daily"
# Create activation key
kk admin admin activation_key create --name katellome --org QE --environment DEV
for i in `kk admin admin org subscriptions --name QE | grep ^Id: | awk '{print $2}'`; do kk admin admin activation_key update --name katellome --org QE --add_subscription $i; done
# Create the Alphabet Soup organization and environments
kk admin admin org create --name "AlphabetSoup"
kk admin admin environment create --name Cook --prior Library --org AlphabetSoup
kk admin admin environment create --name Taste --prior Cook --org AlphabetSoup
kk admin admin environment create --name Sell --prior Taste --org AlphabetSoup
kk admin admin provider create --name Animals --org AlphabetSoup
kk admin admin product create --name Zoo --provider Animals --org AlphabetSoup
kk admin admin gpg_key create --name Zoo --file dummy.gpg --org AlphabetSoup
kk admin admin product update --name Zoo --gpgkey Zoo --org AlphabetSoup
kk admin admin repo create --name Animals --url "http://omaciel.fedorapeople.org/fakerepo01/" --product Zoo --org AlphabetSoup
kk admin admin repo create --name Countries --url "http://omaciel.fedorapeople.org/fakerepo02/" --product Zoo --org AlphabetSoup
kk admin admin repo synchronize --name Animals --product Zoo --org AlphabetSoup
kk admin admin repo synchronize --name Countries --product Zoo --org AlphabetSoup
# Promote it to Cook environment
kk admin admin changeset create --name Cooked1 --environment Cook --org AlphabetSoup
kk admin admin changeset update --name Cooked1 --environment Cook --org AlphabetSoup --add_product Zoo
kk admin admin changeset update --name Cooked1 --environment Cook --org AlphabetSoup --from_product Zoo --add_repo Animals
kk admin admin changeset update --name Cooked1 --environment Cook --org AlphabetSoup --from_product Zoo --add_repo Countries
kk admin admin changeset apply --name Cooked1 --org=AlphabetSoup --environment Cook
# Promote it to Taste environment
kk admin admin changeset create --name TasteBatch1 --environment Taste --org AlphabetSoup
kk admin admin changeset update --name TasteBatch1 --environment Taste --org AlphabetSoup --add_product Zoo
kk admin admin changeset update --name TasteBatch1 --environment Taste --org AlphabetSoup --from_product Zoo --add_repo Animals
kk admin admin changeset update --name TasteBatch1 --environment Taste --org AlphabetSoup --from_product Zoo --add_repo Countries
kk admin admin changeset apply --name TasteBatch1 --environment Taste --org AlphabetSoup
# Promote it to Sell environment
kk admin admin changeset create --name SellBatch1 --environment Sell --org AlphabetSoup
kk admin admin changeset update --name SellBatch1 --environment Sell --org AlphabetSoup --add_product Zoo
kk admin admin changeset update --name SellBatch1 --environment Sell --org AlphabetSoup --from_product Zoo --add_repo Animals
kk admin admin changeset update --name SellBatch1 --environment Sell --org AlphabetSoup --from_product Zoo --add_repo Countries
kk admin admin changeset apply --name SellBatch1 --environment Sell --org AlphabetSoup
# Changed my mind, delete Animals from Sell environment
kk admin admin changeset create --deletion --name DeleteAnimals --environment Sell --org AlphabetSoup
kk admin admin changeset update --name DeleteAnimals --environment Sell --org AlphabetSoup --from_product Zoo --add_repo Animals
kk admin admin changeset apply --name DeleteAnimals --environment Sell --org AlphabetSoup
# Create Lenovo organization and environments
kk admin admin org create --name Lenovo
kk admin admin environment create --org Lenovo --name Development --prior Library
kk admin admin environment create --org Lenovo --name QA --prior Development
kk admin admin environment create --org Lenovo --name Release --prior QA
# Create Lenovo administrator role
kk admin admin user_role create --name "Lenovo Admin"
kk admin admin permission create --user_role "Lenovo Admin" --name "Lenovo Administrator" --org Lenovo --scope all
# Create Lenovo administrator user and assign role
kk admin admin user create --username lenovo_admin --password katello --email "lenovo_admin@somecorp.com"
kk admin admin user assign_role --username lenovo_admin --role "Lenovo Admin"
# Switch context to Lenovo organization
kk lenovo_admin katello client remember --option org --value Lenovo
kk lenovo_admin katello client remember --option env --value Development
# Custom provider1
kk lenovo_admin katello provider create --name="FedoraHosted"
# Pulp product
kk lenovo_admin katello product create --name="Pulp" --provider="FedoraHosted"
kk lenovo_admin katello repo create --name="6Server x86_64" --product="Pulp" --org="Lenovo" --url=http://fedorapeople.org/groups/katello/releases/yum/katello-pulp/RHEL/6Server/x86_64/
# Candlepin product
kk lenovo_admin katello product create --name="Candlepin" --provider="FedoraHosted"
kk lenovo_admin katello repo create --name="6Server x86_64" --product="Candlepin" --org="Lenovo" --url=http://fedorapeople.org/groups/katello/releases/yum/katello-candlepin/RHEL/6Server/x86_64/
# Custom provider2
kk lenovo_admin katello provider create --name="Google"
# Google product
kk lenovo_admin katello product create --name="Chrome" --provider="Google"
kk lenovo_admin katello repo create --name="google-chrome-32bit" --product="Chrome" --org="Lenovo" --url=http://dl.google.com/linux/chrome/rpm/stable/i386
kk lenovo_admin katello repo create --name="google-chrome-x86_64" --product="Chrome" --org="Lenovo" --url=http://dl.google.com/linux/chrome/rpm/stable/x86_64
# "Empty" promotion to Development
kk lenovo_admin katello changeset create --name "empty-products-2-dev" --description "Empty products to Development" --environment Development
kk lenovo_admin katello changeset update --name "empty-products-2-dev" --add_product "Pulp" --environment Development
kk lenovo_admin katello changeset update --name "empty-products-2-dev" --add_product "Candlepin" --environment Development
kk lenovo_admin katello changeset update --name "empty-products-2-dev" --add_product "Chrome" --environment Development
kk lenovo_admin katello changeset apply --name "empty-products-2-dev" --environment Development
# "Empty" promotion to QA
kk lenovo_admin katello changeset create --name "empty-products-2-qa" --description "Empty products to QA" --environment QA
kk lenovo_admin katello changeset update --name "empty-products-2-qa" --add_product "Pulp" --environment QA
kk lenovo_admin katello changeset update --name "empty-products-2-qa" --add_product "Candlepin" --environment QA
kk lenovo_admin katello changeset update --name "empty-products-2-qa" --add_product "Chrome" --environment QA
kk lenovo_admin katello changeset apply --name "empty-products-2-qa" --environment QA
# "Empty" promotion to Release
kk lenovo_admin katello changeset create --name "empty-products-2-release" --description "Empty products to Release" --environment Release
kk lenovo_admin katello changeset update --name "empty-products-2-release" --add_product "Pulp" --environment Release
kk lenovo_admin katello changeset update --name "empty-products-2-release" --add_product "Candlepin" --environment Release
kk lenovo_admin katello changeset update --name "empty-products-2-release" --add_product "Chrome" --environment Release
kk lenovo_admin katello changeset apply --name "empty-products-2-release" --environment Release
# Sync 1
kk lenovo_admin katello provider synchronize --name="FedoraHosted"
# Full promote to development
kk lenovo_admin katello changeset create --name "all-to-development" --description "Promote all products and packages to Development" --environment Development
kk lenovo_admin katello changeset update --name "all-to-development" --add_product "Pulp" --environment Development
kk lenovo_admin katello changeset update --name "all-to-development" --add_product "Candlepin" --environment Development
kk lenovo_admin katello changeset apply --name "all-to-development" --environment Development
# Partial promote 1-0
kk lenovo_admin katello changeset create --name "few-pulp-qa" --description "Promote 3 Pulp packages to QA." --environment QA
kk lenovo_admin katello changeset update --name "few-pulp-qa" --from_product Pulp --add_package "gofer" --environment QA
kk lenovo_admin katello changeset update --name "few-pulp-qa" --from_product Pulp --add_package "gofer-package" --environment QA
kk lenovo_admin katello changeset update --name "few-pulp-qa" --from_product Pulp --add_package "grinder" --environment QA
kk lenovo_admin katello changeset apply --name "few-pulp-qa" --environment QA
# Promote Candlepin to QA
kk lenovo_admin katello changeset create --name "candlepin-to-qa" --description "First time promoting Candlepin to QA." --environment QA
kk lenovo_admin katello changeset update --name "candlepin-to-qa" --add_product "Candlepin" --environment QA
kk lenovo_admin katello changeset apply --name "candlepin-to-qa" --environment QA
# Partial promote 2-0
kk lenovo_admin katello changeset create --name "few-candlepin-release" --description "Promote 2 Candlepin packages to Release." --environment Release
kk lenovo_admin katello changeset update --name "few-candlepin-release" --from_product Candlepin --add_package "akuma" --environment Release
#kk lenovo_admin katello changeset update --name "few-candlepin-release" --from_product Candlepin --add_package "akuma-debuginfo" --environment Release
kk lenovo_admin katello changeset apply --name "few-candlepin-release" --environment Release
## Sync plans
kk lenovo_admin katello sync_plan create --org Lenovo --interval hourly --date `date +"%Y-%m-%d"` --time `date -d "+20 minute" +"%H:%M:%S-04:00"` --name "Hourly"
kk lenovo_admin katello product set_plan --org Lenovo --name "Pulp" --plan Hourly
kk lenovo_admin katello sync_plan create --org Lenovo --interval weekly --date `date +"%Y-%m-%d"` --name "Weekly"
kk lenovo_admin katello product set_plan --org Lenovo --name "Candlepin" --plan Weekly
# Create Lenovo restricted role
kk admin admin user_role create --name "Lenovo Viewer"
kk admin admin permission create --user_role "Lenovo Viewer" --name "read-fedorahosted-provider" --org Lenovo --scope providers --verbs read --tag FedoraHosted
kk admin admin permission create --user_role "Lenovo Viewer" --name "read-env-dev-qa-content" --org Lenovo --scope environments --verbs read_contents --tag Development,QA
# Create Lenovo restricted user and assign role
kk admin admin user create --username lenovo_user --password katello --email "lenovo_user@somecorp.com"
kk admin admin user assign_role --username lenovo_user --role "Lenovo Viewer"
# Create Lenovo admin user, use French locale and assign role
kk admin admin user create --username french_user --password katello --email "french_user@somecorp.com" --default_organization Lenovo --default_environment Release --default_locale fr
kk admin admin user assign_role --username french_user --role "Lenovo Viewer"
# Create Lenovo user, use Brazilian Portuguese locale
kk admin admin user create --username brazilian_user --password katello --email "brazilian_user@somecorp.com" --default_organization Lenovo --default_environment Development --default_locale pt-BR
kk admin admin user assign_role --username brazilian_user --role "Read Everything"
# Create Lenovo user, use Japanese locale
kk admin admin user create --username japanese_user --password katello --email "japanese_user@somecorp.com" --default_organization Lenovo --default_environment Development --default_locale ja
kk admin admin user assign_role --username japanese_user --role "Read Everything"
# Create Starbucks organization and environments
kk admin admin org create --name Starbucks
kk admin admin environment create --org Starbucks --name Demi --prior Library
kk admin admin environment create --org Starbucks --name Grande --prior Demi
kk admin admin environment create --org Starbucks --name Venti --prior Grande
# Create Starbucks administrator role
kk admin admin user_role create --name "Starbucks Admin"
kk admin admin permission create --user_role "Starbucks Admin" --name "Starbucks Administrator" --org Starbucks --scope all
# Create Starbucks administrator user and assign role
kk admin admin user create --username starbucks_admin --password katello --email "starbucks_admin@somecorp.com"
kk admin admin user assign_role --username starbucks_admin --role "Starbucks Admin"
# Switch context to Starbucks organization
kk starbucks_admin katello client remember --option org --value Starbucks
kk starbucks_admin katello client remember --option env --value Demi
# Custom provider1
kk starbucks_admin katello provider create --name="DarkRoasted"
# Verona product
kk starbucks_admin katello product create --name="Verona" --provider="DarkRoasted"
kk starbucks_admin katello repo create --name="Decaf" --product="Verona" --org="Starbucks" --url=http://fedorapeople.org/groups/katello/releases/yum/katello-pulp/RHEL/6Server/x86_64/
# Sumatra product
kk starbucks_admin katello product create --name="Sumatra" --provider="DarkRoasted"
kk starbucks_admin katello repo create --name="Decaf" --product="Sumatra" --org="Starbucks" --url=http://fedorapeople.org/groups/katello/releases/yum/katello-candlepin/RHEL/6Server/x86_64/
# Komodo product
kk starbucks_admin katello product create --name="Komodo" --provider="DarkRoasted"
kk starbucks_admin katello repo create --name="Fair Trade" --product="Komodo" --org="Starbucks" --url=http://dl.google.com/linux/chrome/rpm/stable/i386
kk starbucks_admin katello repo create --name="Gold Coast" --product="Komodo" --org="Starbucks" --url=http://dl.google.com/linux/chrome/rpm/stable/x86_64
# Sync 1
kk starbucks_admin katello provider synchronize --name="DarkRoasted"
# Custom provider2
kk starbucks_admin katello provider create --name="FrenchPress"
# Zoo product
kk starbucks_admin katello product create --name="Ethiopia" --provider="FrenchPress"
kk starbucks_admin katello repo create --name="Decaf" --product="Ethiopia" --org="Starbucks" --url=http://inecas.fedorapeople.org/fakerepos/zoo/
# Sync 2
kk starbucks_admin katello provider synchronize --name="FrenchPress"
# Promote all to Demi
kk starbucks_admin katello changeset create --name "products-2-demi" --description "All products to Demi" --environment Demi
kk starbucks_admin katello changeset update --name "products-2-demi" --add_product "Verona" --environment Demi
kk starbucks_admin katello changeset update --name "products-2-demi" --add_product "Sumatra" --environment Demi
kk starbucks_admin katello changeset update --name "products-2-demi" --add_product "Komodo" --environment Demi
kk starbucks_admin katello changeset update --name "products-2-demi" --add_product "Ethiopia" --environment Demi
kk starbucks_admin katello changeset apply --name "products-2-demi" --environment Demi
# Promote only Sumatra and Komodo to Grande
kk starbucks_admin katello changeset create --name "products-2-grande" --description "Promote only Sumatra and Komodo products to Grande" --environment Grande
kk starbucks_admin katello changeset update --name "products-2-grande" --add_product "Sumatra" --environment Grande
kk starbucks_admin katello changeset update --name "products-2-grande" --add_product "Komodo" --environment Grande
kk starbucks_admin katello changeset apply --name "products-2-grande" --environment Grande
# Promote only Komodo to Venti
kk starbucks_admin katello changeset create --name "products-2-venti" --description "Promote only Komodo product to Venti" --environment Venti
kk starbucks_admin katello changeset update --name "products-2-venti" --add_product "Komodo" --environment Venti
kk starbucks_admin katello changeset apply --name "products-2-venti" --environment Venti
# Delete a single errata item from Demi environment
kk starbucks_admin katello changeset create --name "DeleteBear1" --env Demi --org Starbucks --deletion
kk starbucks_admin katello changeset update --name "DeleteBear1" --env Demi --org Starbucks --from_product Ethiopia --add_erratum "RHEA-2012:0001"
kk starbucks_admin katello changeset apply --name "DeleteBear1" --env Demi --org Starbucks
# Create Starbucks admin user, use Korean locale and assign role
kk admin admin user create --username korean_user --password katello --email "korean_user@somecorp.com" --default_organization Starbucks --default_environment Venti --default_locale ko
kk admin admin user assign_role --username korean_user --role "Starbucks Admin"
# Create Starbucks user, use Chinese Simplified locale
kk admin admin user create --username chinese_user1 --password katello --email "chinese_user1@somecorp.com" --default_organization Starbucks --default_environment Demi --default_locale zh-CN
kk admin admin user assign_role --username chinese_user1 --role "Read Everything"
# Create Starbucks user, use Chinese (Taiwan) locale
kk admin admin user create --username chinese_user2 --password katello --email "chinese_user2@somecorp.com" --default_organization Starbucks --default_environment Grande --default_locale zh-TW
kk admin admin user assign_role --username chinese_user2 --role "Read Everything"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.