Skip to content

Instantly share code, notes, and snippets.

@johnpmitsch
Created February 15, 2018 22:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save johnpmitsch/b08415e906dcb000b244bc771838fa01 to your computer and use it in GitHub Desktop.
Save johnpmitsch/b08415e906dcb000b244bc771838fa01 to your computer and use it in GitHub Desktop.
add SUSE repo to pulp script
#!/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)
@johnpmitsch
Copy link
Author

requires httpie yum install httpie

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment