Class: HammerCLIKatello::CommandExtensions::KickstartRepository

Inherits:
HammerCLI::CommandExtensions
  • Object
show all
Defined in:
lib/hammer_cli_katello/command_extensions/kickstart_repository.rb

Class Method Summary collapse

Class Method Details

.fetch_repo_id(cv_id, env_id, repo_name) ⇒ Object



34
35
36
37
38
39
40
41
42
43
44
45
46
47
# File 'lib/hammer_cli_katello/command_extensions/kickstart_repository.rb', line 34

def self.fetch_repo_id(cv_id, env_id, repo_name)
  repo_resource = HammerCLIForeman.foreman_resource(:repositories)
  index_options = {
    content_view_id: cv_id,
    environment_id: env_id,
    name: repo_name
  }
  repos = repo_resource.call(:index, index_options)['results']
  if repos.empty?
    raise _("No such repository with name %{name}, in lifecycle environment"\
              " %{environment_id} and content view %{content_view_id}") % index_options
  end
  repos.first['id']
end