module Pulpsak
Constants
- VERSION
Public Class Methods
distribution_inspect_by_name(name)
click to toggle source
# File lib/pulpsak.rb, line 75 def self.distribution_inspect_by_name(name) api_instance = PulpRpmClient::DistributionsRpmApi.new api_instance.list.results.each do |dist| if dist.name == name return dist end end return nil end
find_existing_publication(pub_opts)
click to toggle source
# File lib/pulpsak.rb, line 115 def self.find_existing_publication(pub_opts) pub_api = PulpRpmClient::PublicationsRpmApi.new existing_publication = nil if pub_opts.has_key?(:repository_version) # if we have a specific version, we can look through all # existing publications to avoid creating one, which can be # expensive pub_api.list.results.each do |pub| pub_hash = pub.to_hash match = true [:metadata_checksum_type,:package_checksum_type,:gpgcheck,:repo_gpgcheck,:repository_version].each do |p| if pub_opts[p] != pub_hash[p] match = false break end end if match existing_publication = pub break end end end return existing_publication end
remote_inspect(href)
click to toggle source
# File lib/pulpsak.rb, line 62 def self.remote_inspect(href) api_instance = PulpRpmClient::RemotesRpmApi.new return api_instance.read(href) end
remote_inspect_by_name(name)
click to toggle source
# File lib/pulpsak.rb, line 66 def self.remote_inspect_by_name(name) api_instance = PulpRpmClient::RemotesRpmApi.new api_instance.list.results.each do |remote| if remote.name == name return remote_inspect(remote.pulp_href) end end return nil end
repository_inspect(href)
click to toggle source
# File lib/pulpsak.rb, line 45 def self.repository_inspect(href) api_instance = PulpRpmClient::RepositoriesRpmApi.new return api_instance.read(href) end
repository_inspect_by_name(name)
click to toggle source
# File lib/pulpsak.rb, line 53 def self.repository_inspect_by_name(name) api_instance = PulpRpmClient::RepositoriesRpmApi.new api_instance.list.results.each do |repo| if repo.name == name return repository_inspect(repo.pulp_href) end end return nil end
repository_version_inspect(href)
click to toggle source
# File lib/pulpsak.rb, line 49 def self.repository_version_inspect(href) api_instance = PulpRpmClient::RepositoriesRpmVersionsApi.new return api_instance.read(href) end
task_cancel(href)
click to toggle source
# File lib/pulpsak.rb, line 88 def self.task_cancel(href) api_instance = PulpcoreClient::TasksApi.new return api_instance.tasks_cancel(href) end
task_inspect(href)
click to toggle source
# File lib/pulpsak.rb, line 84 def self.task_inspect(href) api_instance = PulpcoreClient::TasksApi.new return api_instance.read(href) end
wait_on_task(href,sleep_time: 3, spacer: '.', final: "\n")
click to toggle source
# File lib/pulpsak.rb, line 92 def self.wait_on_task(href,sleep_time: 3, spacer: '.', final: "\n") api = PulpcoreClient::TasksApi.new last_message = '' while true i = Pulpsak.task_inspect(href) if i.state == 'running' or i.state == 'waiting' if i.progress_reports.respond_to?(:length) and i.progress_reports.length() > 0 if last_message != i.progress_reports[-1].message last_message = i.progress_reports[-1].message print last_message,"\n" end else print spacer end sleep sleep_time else break end end print final task = Pulpsak.task_inspect(href) return task end