Class: HammerCLIKatello::Repository::UploadContentCommand
- Inherits:
-
InfoCommand
- Object
- HammerCLIForeman::InfoCommand
- InfoCommand
- HammerCLIKatello::Repository::UploadContentCommand
- Includes:
- HammerCLIForemanTasks::Helper, HammerCLIKatello::RepositoryScopedToProduct
- Defined in:
- lib/hammer_cli_katello/repository.rb
Defined Under Namespace
Classes: BinaryPath
Constant Summary collapse
- CONTENT_CHUNK_SIZE =
bytes
4_000_000
Instance Method Summary collapse
Methods included from HammerCLIKatello::RepositoryScopedToProduct
Methods included from HammerCLIKatello::ResolverCommons
Instance Method Details
#content_upload_resource ⇒ Object
238 239 240 |
# File 'lib/hammer_cli_katello/repository.rb', line 238 def content_upload_resource ::HammerCLIForeman.foreman_resource(:content_uploads) end |
#execute ⇒ Object
221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 |
# File 'lib/hammer_cli_katello/repository.rb', line 221 def execute @failure = false files = option_content 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
217 218 219 |
# File 'lib/hammer_cli_katello/repository.rb', line 217 def request_headers {:content_type => 'multipart/form-data'} end |