class HammerCLIKatello::Repository::UpdateCommand

Public Instance Methods

content_upload_resource() click to toggle source
# File lib/hammer_cli_katello/repository.rb, line 320
def content_upload_resource
  ::HammerCLIForeman.foreman_resource(:content_uploads)
end
create_content_upload() click to toggle source
# File lib/hammer_cli_katello/repository.rb, line 342
def create_content_upload
  response = content_upload_resource.call(:create,
                                          :repository_id => get_identifier,
                                          :size => 0
                                         )

  response["upload_id"]
end
execute() click to toggle source
Calls superclass method
# File lib/hammer_cli_katello/repository.rb, line 308
def execute
  @failure = false

  if option_docker_tag
    upload_tag(option_docker_tag, option_docker_digest)
  else
    super
  end

  @failure ? HammerCLI::EX_DATAERR : HammerCLI::EX_OK
end
import_uploads(uploads, opts = {}) click to toggle source
# File lib/hammer_cli_katello/repository.rb, line 351
def import_uploads(uploads, opts = {})
  publish_repository = opts.fetch(:last_file, false)
  sync_capsule = opts.fetch(:last_file, false)
  params = {:id => get_identifier,
            :uploads => uploads,
            publish_repository: publish_repository,
            sync_capsule: sync_capsule,
            content_type: "docker_tag"
  }
  resource.call(:import_uploads, params)
end
upload_tag(tag, digest) click to toggle source
# File lib/hammer_cli_katello/repository.rb, line 324
def upload_tag(tag, digest)
  upload_id = create_content_upload
  import_uploads([
    {
      id: upload_id,
      name: tag,
      digest: digest
    }
  ], last_file: true)
  print_message _("Repository updated")
rescue => e
  @failure = true
  logger.error e
  output.print_error _("Failed to upload tag '%s' to repository.") % tag
ensure
  content_upload_resource.call(:destroy, :repository_id => get_identifier, :id => upload_id)
end