Class: Actions::SccManager::CreateRepository

Inherits:
Base
  • Object
show all
Includes:
Dynflow::Action::WithSubPlans
Defined in:
app/lib/actions/scc_manager/subscribe_product.rb

Instance Method Summary collapse

Instance Method Details

#create_sub_plansObject



113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
# File 'app/lib/actions/scc_manager/subscribe_product.rb', line 113

def create_sub_plans
  product = ::Katello::Product.find(input[:product_id])
  label = ::Katello::Util::Model.labelize(input[:uniq_name])
  unprotected = true
  gpg_key = product.gpg_key
  repo_param = { :label => label,
                 :name => input[:pretty_repo_name],
                 :content_type => 'yum',
                 :unprotected => unprotected,
                 :gpg_key => gpg_key,
                 :arch => input[:arch],
                 :download_policy => input[:download_policy],
                 :mirroring_policy => input[:mirroring_policy] }
  repository = product.add_repo(repo_param)
  if repository.has_attribute?('upstream_authentication_token')
    repository.url = input[:url]
    repository.upstream_authentication_token = input[:token]
  else
    repository.url = input[:token].blank? ? input[:url] : "#{input[:url]}?#{input[:token]}"
  end

  repository.verify_ssl_on_sync = true
  trigger(::Actions::Katello::Repository::CreateRoot, repository).tap do
    output[:katello_root_repository_id] = repository.id
  end
end