Class: Actions::Pulp::Repository::UpdateSchedule
- Inherits:
-
Abstract
- Object
- Base
- Abstract
- Actions::Pulp::Repository::UpdateSchedule
show all
- Defined in:
- app/lib/actions/pulp/repository/update_schedule.rb
Instance Method Summary
collapse
Methods inherited from Abstract
#pulp_extensions, #pulp_resources
Instance Method Details
#create(repo, params) ⇒ Object
27
28
29
30
31
32
33
34
|
# File 'app/lib/actions/pulp/repository/update_schedule.rb', line 27
def create(repo, params)
pulp_resources.repository_schedule.create(
repo.pulp_id,
repo.importer_type,
params[:schedule],
params
)
end
|
#run ⇒ Object
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
|
# File 'app/lib/actions/pulp/repository/update_schedule.rb', line 11
def run
repo = ::Katello::Repository.find(input[:repo_id])
schedules = pulp_resources.repository_schedule.list(repo.pulp_id, repo.importer_type)
params = {}
params[:schedule] = input[:schedule] if input.key?(:schedule)
params[:enabled] = input[:enabled] if input.key?(:enabled)
if schedules.empty?
output[:response] = create(repo, params)
else
schedule = schedules.first
output[:response] = update(repo, schedule['_id'], params)
end
end
|
#update(repo, schedule_id, params) ⇒ Object
36
37
38
39
40
41
42
43
|
# File 'app/lib/actions/pulp/repository/update_schedule.rb', line 36
def update(repo, schedule_id, params)
pulp_resources.repository_schedule.update(
repo.pulp_id,
repo.importer_type,
schedule_id,
params
)
end
|