Class: HammerCLIKatello::Repository::UpdateCommand
Instance Method Summary
collapse
validate_repo_name_requires_product_options
included, #org_options
included
Instance Method Details
#content_upload_resource ⇒ Object
282
283
284
|
# File 'lib/hammer_cli_katello/repository.rb', line 282
def content_upload_resource
::HammerCLIForeman.foreman_resource(:content_uploads)
end
|
#create_content_upload ⇒ Object
304
305
306
307
308
309
310
311
|
# File 'lib/hammer_cli_katello/repository.rb', line 304
def create_content_upload
response = content_upload_resource.call(:create,
:repository_id => get_identifier,
:size => 0
)
response["upload_id"]
end
|
#execute ⇒ Object
270
271
272
273
274
275
276
277
278
279
280
|
# File 'lib/hammer_cli_katello/repository.rb', line 270
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 = {}) ⇒ Object
313
314
315
316
317
318
319
320
321
322
323
|
# File 'lib/hammer_cli_katello/repository.rb', line 313
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) ⇒ Object
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
|
# File 'lib/hammer_cli_katello/repository.rb', line 286
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
|