Class: HammerCLIKatello::ContentViewVersion::ExportDefaultCommand

Inherits:
HammerCLIForeman::Command
  • Object
show all
Includes:
ApipieHelper, LocalHelper
Defined in:
lib/hammer_cli_katello/content_view_version.rb

Constant Summary collapse

PUBLISHED_REPOS_DIR =
"/var/lib/pulp/published/yum/https/repos/".freeze

Instance Method Summary collapse

Methods included from ApipieHelper

#call, #destroy, #index, #show, #update

Methods included from LocalHelper

#parse_subcommand

Instance Method Details

#executeObject



292
293
294
295
296
297
298
299
300
301
302
303
304
# File 'lib/hammer_cli_katello/content_view_version.rb', line 292

def execute
  export_dir = options['option_export_dir']

  Dir.mkdir(export_dir) unless Dir.exist?(export_dir)
  result = Kernel.system("rsync -aL #{PUBLISHED_REPOS_DIR} #{export_dir}")
  if result == true
    output.print_message _("Default content view export is available at #{export_dir}")
    HammerCLI::EX_OK
  else
    output.print_error _("Could not export the default content view at #{export_dir}")
    HammerCLI::EX_CANTCREAT
  end
end