Class: HammerCLIKatello::Repository::UpdateCommand
Instance Method Summary
collapse
validate_repo_name_requires_product_options
included, #org_options
included, #request_params
included
Instance Method Details
#content_upload_resource ⇒ Object
268
269
270
|
# File 'lib/hammer_cli_katello/repository.rb', line 268
def content_upload_resource
::HammerCLIForeman.foreman_resource(:content_uploads)
end
|
#create_content_upload ⇒ Object
290
291
292
293
294
295
296
297
|
# File 'lib/hammer_cli_katello/repository.rb', line 290
def create_content_upload
response = content_upload_resource.call(:create,
:repository_id => get_identifier,
:size => 0
)
response["upload_id"]
end
|
#execute ⇒ Object
256
257
258
259
260
261
262
263
264
265
266
|
# File 'lib/hammer_cli_katello/repository.rb', line 256
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
299
300
301
302
303
304
305
306
307
308
309
|
# File 'lib/hammer_cli_katello/repository.rb', line 299
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
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
|
# File 'lib/hammer_cli_katello/repository.rb', line 272
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
|