module HammerCLIKatello::ContentImport::ContentImportCommon
Public Class Methods
included(base)
click to toggle source
# File lib/hammer_cli_katello/content_import.rb, line 7 def self.included(base) base.option "--metadata-file", "METADATA_FILE", _("Location of the metadata.json file. "\ "This is not required if the metadata.json file"\ " is already in the archive directory."), :attribute_name => :option_metadata_file, :required => false base.build_options do |o| o.expand(:all).including(:organizations).except(:metadata) end base.validate_options do option(:option_path).required metadata_file = option(:option_metadata_file).value || File.join(option(:option_path).value, "metadata.json") unless File.exist?(metadata_file) msg = _("Unable to find '#{metadata_file}'. "\ "If the metadata.json file is at a different location "\ "provide it to the --metadata-file option ") raise HammerCLI::Options::Validators::ValidationError, msg end end base.success_message _("Archive is being imported in task %{id}.") base.failure_message _("Could not import the archive.") end
Public Instance Methods
request_params()
click to toggle source
Calls superclass method
# File lib/hammer_cli_katello/content_import.rb, line 35 def request_params super.tap do |opts| metadata_file = option_metadata_file || File.join(option_path, "metadata.json") opts["metadata"] = JSON.parse(File.read(metadata_file)) end end