Class: HammerCLIKatello::Repository::UploadContentCommand
- Inherits:
-
InfoCommand
- Object
- HammerCLIForeman::InfoCommand
- InfoCommand
- HammerCLIKatello::Repository::UploadContentCommand
- Extended by:
- HammerCLIKatello::RepositoryScopedToProduct
- Includes:
- HammerCLIForemanTasks::Helper
- Defined in:
- lib/hammer_cli_katello/repository.rb
Overview
rubocop:disable ClassLength
Defined Under Namespace
Classes: BinaryPath
Constant Summary collapse
- CONTENT_CHUNK_SIZE =
bytes to make sure it’s lower than django’s default 2621440
2_500_000
Instance Method Summary collapse
Methods included from HammerCLIKatello::RepositoryScopedToProduct
validate_repo_name_requires_product_options
Methods included from HammerCLIKatello::ResolverCommons
Instance Method Details
#content_upload_resource ⇒ Object
411 412 413 |
# File 'lib/hammer_cli_katello/repository.rb', line 411 def content_upload_resource ::HammerCLIForeman.foreman_resource(:content_uploads) end |
#execute ⇒ Object
394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 |
# File 'lib/hammer_cli_katello/repository.rb', line 394 def execute @failure = false files = option_content.sort if files.length.zero? output.print_error _("Could not find any files matching PATH") return HammerCLI::EX_NOINPUT end files.each do |file_path| last_file = file_path == files.last File.open(file_path, 'rb') { |file| upload_file(file, last_file: last_file) } end @failure ? HammerCLI::EX_DATAERR : HammerCLI::EX_OK end |
#request_headers ⇒ Object
390 391 392 |
# File 'lib/hammer_cli_katello/repository.rb', line 390 def request_headers {:content_type => 'multipart/form-data'} end |