Created
February 15, 2018 22:43
-
-
Save johnpmitsch/b08415e906dcb000b244bc771838fa01 to your computer and use it in GitHub Desktop.
add SUSE repo to pulp script
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/ruby | |
# ./script.rb REPOID FEEDURL QUERYAUTHTOKEN | |
# | |
def cmd(command) | |
puts command | |
result = `#{command}` | |
puts result | |
puts "\n" | |
end | |
add_repo = "pulp-admin -u admin -p admin rpm repo create --repo-id #{ARGV[0]} --relative-url #{ARGV[0]} --serve-http true --feed #{ARGV[1]} --download-policy on_demand" | |
cmd(add_repo) | |
add_query_auth_token = "http --verify no --cert /etc/pki/katello/certs/pulp-client.crt --cert-key /etc/pki/katello/private/pulp-client.key --json PUT https://localhost/pulp/api/v2/repositories/#{ARGV[0]}/ importer_config:='{\"query_auth_token\": \"#{ARGV[2]}\"}'" | |
cmd(add_query_auth_token) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
requires httpie
yum install httpie