katello 4.0.0.rc3 → 4.0.1.2

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of katello might be problematic. Click here for more details.

Files changed (126) hide show
  1. checksums.yaml +4 -4
  2. data/app/controllers/katello/api/registry/registry_proxies_controller.rb +7 -9
  3. data/app/controllers/katello/api/v2/repositories_controller.rb +4 -3
  4. data/app/helpers/katello/katello_urls_helper.rb +2 -2
  5. data/app/lib/actions/katello/agent_action.rb +26 -17
  6. data/app/lib/actions/katello/bulk_agent_action.rb +18 -5
  7. data/app/lib/actions/katello/capsule_content/sync_capsule.rb +44 -6
  8. data/app/lib/actions/katello/content_view/promote.rb +25 -0
  9. data/app/lib/actions/katello/content_view/publish.rb +29 -0
  10. data/app/lib/actions/katello/jail_concern/content_view.rb +30 -0
  11. data/app/lib/actions/katello/jail_concern/organization.rb +30 -0
  12. data/app/lib/actions/katello/repository/sync.rb +59 -0
  13. data/app/lib/katello/agent/client_message_handler.rb +12 -3
  14. data/app/lib/katello/agent/connection.rb +20 -6
  15. data/app/lib/katello/event_daemon/monitor.rb +1 -0
  16. data/app/lib/katello/event_daemon/services/agent_event_receiver.rb +11 -14
  17. data/app/lib/katello/qpid/connection.rb +31 -14
  18. data/app/models/katello/agent/dispatch_history.rb +2 -0
  19. data/app/models/katello/authorization/content_view.rb +12 -0
  20. data/app/models/katello/authorization/repository.rb +18 -0
  21. data/app/models/katello/concerns/hostgroup_extensions.rb +1 -1
  22. data/app/models/katello/concerns/redhat_extensions.rb +5 -8
  23. data/app/models/katello/concerns/smart_proxy_extensions.rb +15 -1
  24. data/app/models/katello/content_view.rb +13 -7
  25. data/app/models/katello/glue/pulp/repo.rb +6 -12
  26. data/app/models/katello/host/content_facet.rb +1 -1
  27. data/app/models/katello/ping.rb +5 -5
  28. data/app/models/katello/repository.rb +2 -2
  29. data/app/models/katello/root_repository.rb +1 -1
  30. data/app/services/katello/agent/dispatcher.rb +18 -24
  31. data/app/services/katello/applicability/applicable_content_helper.rb +8 -6
  32. data/app/services/katello/managed_content_medium_provider.rb +4 -4
  33. data/app/services/katello/pulp/repository/yum.rb +1 -1
  34. data/app/services/katello/pulp3/migration.rb +6 -5
  35. data/app/services/katello/pulp3/repository.rb +33 -8
  36. data/app/services/katello/pulp3/repository/apt.rb +1 -2
  37. data/app/services/katello/pulp3/repository/yum.rb +2 -2
  38. data/app/services/katello/pulp3/task_group.rb +3 -0
  39. data/db/seeds.d/111-upgrade_tasks.rb +0 -12
  40. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/products/bulk/views/products-bulk-advanced-sync-modal.html +2 -2
  41. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/products/details/repositories/new/views/new-repository.html +3 -4
  42. data/lib/katello/engine.rb +16 -12
  43. data/lib/katello/plugin.rb +5 -2
  44. data/lib/katello/tasks/clean_backend_objects.rake +0 -25
  45. data/lib/katello/version.rb +1 -1
  46. data/lib/proxy_api/container_gateway.rb +22 -11
  47. data/locale/action_names.rb +24 -28
  48. data/locale/bn/katello.po +135 -99
  49. data/locale/cs/katello.po +135 -98
  50. data/locale/de/katello.po +136 -100
  51. data/locale/en/katello.po +135 -98
  52. data/locale/es/katello.po +136 -100
  53. data/locale/fr/katello.po +136 -99
  54. data/locale/gu/katello.po +135 -99
  55. data/locale/hi/katello.po +135 -99
  56. data/locale/it/katello.po +136 -99
  57. data/locale/ja/katello.po +136 -99
  58. data/locale/katello.pot +756 -697
  59. data/locale/kn/katello.po +135 -99
  60. data/locale/ko/katello.po +136 -99
  61. data/locale/mr/katello.po +135 -99
  62. data/locale/or/katello.po +135 -99
  63. data/locale/pa/katello.po +135 -99
  64. data/locale/pt/katello.po +135 -99
  65. data/locale/pt_BR/katello.po +136 -99
  66. data/locale/ru/katello.po +136 -99
  67. data/locale/ta/katello.po +135 -99
  68. data/locale/te/katello.po +135 -99
  69. data/locale/zh_CN/katello.po +136 -99
  70. data/locale/zh_TW/katello.po +136 -100
  71. data/webpack/scenes/ContentViews/Details/Repositories/__tests__/contentViewDetailRepos.fixtures.json +2 -2
  72. metadata +36 -74
  73. data/lib/katello/tasks/upgrades/3.10/clear_invalid_repo_credentials.rake +0 -27
  74. data/lib/katello/tasks/upgrades/3.11/import_yum_metadata_file.rake +0 -12
  75. data/lib/katello/tasks/upgrades/3.11/update_puppet_repos.rake +0 -29
  76. data/lib/katello/tasks/upgrades/3.12/remove_pulp2_notifier.rake +0 -13
  77. data/lib/katello/tasks/upgrades/3.13/republish_deb_metadata.rake +0 -22
  78. data/lib/katello/tasks/upgrades/3.15/reindex_rpm_modular.rake +0 -23
  79. data/lib/katello/tasks/upgrades/3.15/set_sub_facet_dmi_uuid.rake +0 -16
  80. data/lib/katello/tasks/upgrades/3.16/update_applicable_el8_hosts.rake +0 -29
  81. data/lib/katello/tasks/upgrades/3.18/add_cvv_export_history_metadata.rb +0 -18
  82. data/lib/katello/tasks/upgrades/3.8/clear_checksum_type.rake +0 -41
  83. data/locale/bn/katello.edit.po +0 -8538
  84. data/locale/bn/katello.po.time_stamp +0 -0
  85. data/locale/cs/katello.edit.po +0 -8440
  86. data/locale/cs/katello.po.time_stamp +0 -0
  87. data/locale/de/katello.edit.po +0 -8344
  88. data/locale/de/katello.po.time_stamp +0 -0
  89. data/locale/en/katello.edit.po +0 -8161
  90. data/locale/en/katello.po.time_stamp +0 -0
  91. data/locale/es/katello.edit.po +0 -8306
  92. data/locale/es/katello.po.time_stamp +0 -0
  93. data/locale/fr/katello.edit.po +0 -8356
  94. data/locale/fr/katello.po.time_stamp +0 -0
  95. data/locale/gu/katello.edit.po +0 -8540
  96. data/locale/gu/katello.po.time_stamp +0 -0
  97. data/locale/hi/katello.edit.po +0 -8537
  98. data/locale/hi/katello.po.time_stamp +0 -0
  99. data/locale/it/katello.edit.po +0 -8293
  100. data/locale/it/katello.po.time_stamp +0 -0
  101. data/locale/ja/katello.edit.po +0 -8322
  102. data/locale/ja/katello.po.time_stamp +0 -0
  103. data/locale/kn/katello.edit.po +0 -8538
  104. data/locale/kn/katello.po.time_stamp +0 -0
  105. data/locale/ko/katello.edit.po +0 -8289
  106. data/locale/ko/katello.po.time_stamp +0 -0
  107. data/locale/mr/katello.edit.po +0 -8502
  108. data/locale/mr/katello.po.time_stamp +0 -0
  109. data/locale/or/katello.edit.po +0 -8538
  110. data/locale/or/katello.po.time_stamp +0 -0
  111. data/locale/pa/katello.edit.po +0 -8524
  112. data/locale/pa/katello.po.time_stamp +0 -0
  113. data/locale/pt/katello.edit.po +0 -8255
  114. data/locale/pt/katello.po.time_stamp +0 -0
  115. data/locale/pt_BR/katello.edit.po +0 -8289
  116. data/locale/pt_BR/katello.po.time_stamp +0 -0
  117. data/locale/ru/katello.edit.po +0 -8309
  118. data/locale/ru/katello.po.time_stamp +0 -0
  119. data/locale/ta/katello.edit.po +0 -8536
  120. data/locale/ta/katello.po.time_stamp +0 -0
  121. data/locale/te/katello.edit.po +0 -8536
  122. data/locale/te/katello.po.time_stamp +0 -0
  123. data/locale/zh_CN/katello.edit.po +0 -8288
  124. data/locale/zh_CN/katello.po.time_stamp +0 -0
  125. data/locale/zh_TW/katello.edit.po +0 -8420
  126. data/locale/zh_TW/katello.po.time_stamp +0 -0
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 25c755b23475d0447099ee99388c1d900ae9815b1e4be88ab5d13afeb7d044d2
4
- data.tar.gz: 4482488f5ff9186dfe7f7db25901b2afa00b979c2fbf926ccfc329983a122661
3
+ metadata.gz: 175f5091971a1a03e1ef6045897717e644600f46baa4255e76703b17f37a5bd6
4
+ data.tar.gz: e9f6e8a076b105e02e14bcfd4bfe61c4b50bd98b6fc96fd64e8be422e2c81696
5
5
  SHA512:
6
- metadata.gz: 464106f37ffb3915d1029ea95f9ecdc8d6c985fde7d0a40826dc111aefb1e621c17a79d478ef6538be9f485c35fec13cc1af6ad47a3b30485183a381af71828a
7
- data.tar.gz: 1da0019879786addea556e156ae5b187df06170a0718eff50580d4e9bb8579b9c897fd7729c893bf414068d89813a5f9614d799e7b0584852c6c890ffac8660e
6
+ metadata.gz: 4af5af4d5c32367976e4131d93e55d61c6802696e779615cd8bdf0f4cd1d9b5c1fccee39fdbe8d0c7148eda66ce1201800159537f57a29a1bcd686870f6173c6
7
+ data.tar.gz: e58234ec4c65a357a66c588ee1f2c226ebcfb0a4a843db3f36cda2263724974400601b16a577805a213d1b7dd84aaa46419dcb9f1960546f5b087f892b310e9c
@@ -106,7 +106,7 @@ module Katello
106
106
  return nil unless params[:repository]
107
107
  repository = Repository.docker_type.find_by(container_repository_name: params[:repository])
108
108
  if require_user_authorization?(repository)
109
- repository = readable_repositories.docker_type.find_by(container_repository_name: params[:repository])
109
+ repository = Repository.readable_docker_catalog.find_by(container_repository_name: params[:repository])
110
110
  end
111
111
  repository
112
112
  end
@@ -167,11 +167,9 @@ module Katello
167
167
  end
168
168
 
169
169
  if (manifest_response = redirect_client { Resources::Registry::Proxy.get(@_request.fullpath, headers) })
170
- #when pulp 2 is removed, this should no longer be needed, and all clients should be redirected
171
- logger.debug filter_sensitive_data(manifest_response)
170
+ #for some requests, we get a redirect, but for others we get the actual manifest in response
172
171
  results = JSON.parse(manifest_response)
173
-
174
- response.header['Docker-Content-Digest'] = "sha256:#{Digest::SHA256.hexdigest(manifest_response)}"
172
+ response.header['Docker-Content-Digest'] = manifest_response.headers[:docker_content_digest]
175
173
  # https://docs.docker.com/registry/spec/manifest-v2-2/
176
174
  # If its v2 schema 2 only the mediaType attribute will be present in the manifest
177
175
  media_type = results['mediaType']
@@ -184,8 +182,8 @@ module Katello
184
182
  'application/vnd.docker.distribution.manifest.v1+prettyjws'
185
183
  end
186
184
  end
187
-
188
- render json: manifest_response, content_type: media_type
185
+ response.headers['Content-Type'] = media_type
186
+ render json: manifest_response
189
187
  end
190
188
  end
191
189
 
@@ -333,7 +331,7 @@ module Katello
333
331
  params[:per_page] = params[:n] || 25
334
332
  params[:search] = params[:q]
335
333
 
336
- search_results = scoped_search(readable_repositories.docker_type.distinct,
334
+ search_results = scoped_search(Repository.readable_docker_catalog.distinct,
337
335
  :container_repository_name, :asc, options)
338
336
 
339
337
  results = {
@@ -347,7 +345,7 @@ module Katello
347
345
  end
348
346
 
349
347
  def catalog
350
- repositories = readable_repositories.docker_type.collect do |repository|
348
+ repositories = Repository.readable_docker_catalog.collect do |repository|
351
349
  repository.container_repository_name
352
350
  end
353
351
  render json: { repositories: repositories }
@@ -52,9 +52,9 @@ module Katello
52
52
  param :upstream_password, String, :desc => N_("Password of the upstream repository user used for authentication")
53
53
  param :ostree_upstream_sync_policy, ::Katello::RootRepository::OSTREE_UPSTREAM_SYNC_POLICIES, :desc => N_("policies for syncing upstream ostree repositories")
54
54
  param :ostree_upstream_sync_depth, :number, :desc => N_("if a custom sync policy is chosen for ostree repositories then a 'depth' value must be provided")
55
- param :deb_releases, String, :desc => N_("comma-separated list of releases to be synced from deb-archive")
56
- param :deb_components, String, :desc => N_("comma-separated list of repo components to be synced from deb-archive")
57
- param :deb_architectures, String, :desc => N_("comma-separated list of architectures to be synced from deb-archive")
55
+ param :deb_releases, String, :desc => N_("whitespace-separated list of releases to be synced from deb-archive")
56
+ param :deb_components, String, :desc => N_("whitespace-separated list of repo components to be synced from deb-archive")
57
+ param :deb_architectures, String, :desc => N_("whitespace-separated list of architectures to be synced from deb-archive")
58
58
  param :ignorable_content, Array, :desc => N_("List of content units to ignore while syncing a yum repository. Must be subset of %s") % RootRepository::IGNORABLE_CONTENT_UNIT_TYPES.join(",")
59
59
  param :ansible_collection_requirements, String, :desc => N_("Contents of requirement yaml file to sync from URL")
60
60
  param :http_proxy_policy, ::Katello::RootRepository::HTTP_PROXY_POLICIES, :desc => N_("policies for HTTP proxy for content sync")
@@ -95,6 +95,7 @@ module Katello
95
95
  :required => false
96
96
  param :with_content, RepositoryTypeManager.enabled_content_types, :desc => N_("only repositories having at least one of the specified content type ex: rpm , erratum")
97
97
  param :download_policy, ::Runcible::Models::YumImporter::DOWNLOAD_POLICIES, :desc => N_("limit to only repositories with this download policy")
98
+ param :username, String, :desc => N_("only show the repositories readable by this user with this username")
98
99
  param_group :search, Api::V2::ApiController
99
100
  add_scoped_search_description_for(Repository)
100
101
  def index
@@ -20,7 +20,7 @@ module Katello
20
20
  "#{prefix}/pub/#{config}"
21
21
  end
22
22
 
23
- def repository_url(content_path, content_type = 'repos', schema = 'http')
23
+ def repository_url(content_path, _content_type = nil, schema = 'http')
24
24
  return content_path if content_path =~ %r|^([\w\-\+]+)://|
25
25
  url = if @host.content_source
26
26
  "#{schema}://#{@host.content_source.hostname}"
@@ -33,7 +33,7 @@ module Katello
33
33
  end
34
34
  path = ::Katello::Glue::Pulp::Repos.repo_path_from_content_path(
35
35
  @host.lifecycle_environment, content_path)
36
- "#{url}/pulp/#{content_type}/#{path}"
36
+ "#{url}/pulp/content/#{path}"
37
37
  end
38
38
  end
39
39
  end
@@ -15,22 +15,15 @@ module Actions
15
15
  def plan(host, options)
16
16
  action_subject(host, :hostname => host.name, :content => options[:content])
17
17
 
18
- # if already dispatched by bulk action use the provided history ID
19
- dispatch_history_id = options.dig(:dispatch_histories, host.id.to_s)
20
-
21
- unless dispatch_history_id
22
- histories = ::Katello::Agent::Dispatcher.dispatch(
23
- self.class.agent_message,
24
- [host.id],
25
- content: options[:content]
26
- )
27
-
28
- dispatch_history_id = histories.first.id
29
- end
18
+ dispatch_history_id = options.dig(:dispatch_histories, host.id.to_s) || ::Katello::Agent::Dispatcher.create_histories(
19
+ host_ids: [host.id]
20
+ ).first.id
30
21
 
31
22
  plan_self(
32
23
  host_id: host.id,
33
- dispatch_history_id: dispatch_history_id
24
+ dispatch_history_id: dispatch_history_id,
25
+ content: options[:content],
26
+ bulk: options[:bulk]
34
27
  )
35
28
  end
36
29
 
@@ -38,20 +31,23 @@ module Actions
38
31
  case event
39
32
  when nil
40
33
  history = dispatch_history
34
+ timeout = accept_timeout
41
35
 
42
36
  if history.finished?
43
37
  fail_on_errors
44
38
  return
45
39
  elsif history.accepted?
46
- schedule_timeout(finish_timeout)
47
- else
48
- schedule_timeout(accept_timeout)
40
+ timeout = finish_timeout
49
41
  end
50
42
 
51
43
  suspend do |suspended_action|
52
44
  history.dynflow_execution_plan_id = suspended_action.execution_plan_id
53
45
  history.dynflow_step_id = suspended_action.step_id
54
46
  history.save!
47
+
48
+ dispatch_message(history) unless input[:bulk]
49
+
50
+ schedule_timeout(timeout)
55
51
  end
56
52
  when Dynflow::Action::Timeouts::Timeout
57
53
  process_timeout
@@ -63,6 +59,14 @@ module Actions
63
59
  end
64
60
  end
65
61
 
62
+ def dispatch_message(history)
63
+ ::Katello::Agent::Dispatcher.dispatch(
64
+ self.class.agent_message,
65
+ [history],
66
+ content: input[:content]
67
+ )
68
+ end
69
+
66
70
  def accept_timeout
67
71
  Setting['content_action_accept_timeout']
68
72
  end
@@ -79,7 +83,12 @@ module Actions
79
83
  end
80
84
 
81
85
  unless history.finished?
82
- fail _("Host did not finish content action in %s seconds. The task has been cancelled.") % finish_timeout
86
+ # we could be processing the accept_timeout here
87
+ # only fail for finish_timeout unless the actual duration has elapsed
88
+ finish_limit = history.accepted_at + finish_timeout
89
+ if finish_limit < DateTime.now
90
+ fail _("Host did not finish content action in %s seconds. The task has been cancelled.") % finish_timeout
91
+ end
83
92
  end
84
93
  end
85
94
 
@@ -3,19 +3,32 @@ module Actions
3
3
  class BulkAgentAction < Actions::BulkAction
4
4
  def plan(agent_action, hosts, args)
5
5
  host_ids = hosts.map(&:id)
6
- dispatch_args = {
7
- content: args[:content]
8
- }
9
- histories = ::Katello::Agent::Dispatcher.dispatch(agent_action.agent_message, host_ids, dispatch_args)
6
+
7
+ histories = ::Katello::Agent::Dispatcher.create_histories(
8
+ host_ids: host_ids
9
+ )
10
10
 
11
11
  grouped_histories = {}
12
12
  histories.each { |h| grouped_histories[h.host_id] = h.id }
13
13
  options = {
14
14
  dispatch_histories: grouped_histories,
15
- content: args[:content]
15
+ type: agent_action.agent_message,
16
+ content: args[:content],
17
+ bulk: true
16
18
  }
17
19
  super(agent_action, hosts, options)
18
20
  end
21
+
22
+ def spawn_plans
23
+ args = input[:args].first
24
+ histories = ::Katello::Agent::DispatchHistory.where(id: args[:dispatch_histories].slice(*current_batch.map(&:to_s)).values)
25
+ ::Katello::Agent::Dispatcher.dispatch(
26
+ args[:type].to_sym,
27
+ histories,
28
+ content: args[:content]
29
+ )
30
+ super
31
+ end
19
32
  end
20
33
  end
21
34
  end
@@ -35,15 +35,53 @@ module Actions
35
35
  end
36
36
  end
37
37
  end
38
- update_unauthenticated_repo_list(smart_proxy) if smart_proxy.has_feature?("Container_Gateway")
38
+ sync_container_gateway(smart_proxy)
39
39
  end
40
40
 
41
- def update_unauthenticated_repo_list(smart_proxy)
42
- unauthenticated_repo_list =
43
- ::Katello::SmartProxyHelper.new(smart_proxy).combined_repos_available_to_capsule.select do |repo|
44
- repo.docker? && repo.environment.registry_unauthenticated_pull
41
+ def sync_container_gateway(smart_proxy)
42
+ if smart_proxy.has_feature?(::SmartProxy::CONTAINER_GATEWAY_FEATURE)
43
+ update_container_repo_list(smart_proxy)
44
+ users = smart_proxy.container_gateway_users
45
+ update_user_container_repo_mapping(smart_proxy, users) if users.any?
46
+ end
47
+ end
48
+
49
+ def unauthenticated_container_repositories
50
+ ::Katello::Repository.joins(:environment).where("#{::Katello::KTEnvironment.table_name}.registry_unauthenticated_pull" => true).select(:id).pluck(:id)
51
+ end
52
+
53
+ def update_container_repo_list(smart_proxy)
54
+ # [{ repository: "repoA", auth_required: false }]
55
+ repo_list = []
56
+ ::Katello::SmartProxyHelper.new(smart_proxy).combined_repos_available_to_capsule.each do |repo|
57
+ if repo.docker? && !repo.container_repository_name.nil?
58
+ repo_list << { repository: repo.container_repository_name,
59
+ auth_required: !unauthenticated_container_repositories.include?(repo.id) }
45
60
  end
46
- smart_proxy.update_unauthenticated_repo_list(unauthenticated_repo_list.map(&:container_repository_name))
61
+ end
62
+ smart_proxy.update_container_repo_list(repo_list)
63
+ end
64
+
65
+ def update_user_container_repo_mapping(smart_proxy, users)
66
+ # Example user-repo mapping:
67
+ # { users:
68
+ # [
69
+ # 'user a' => [{ repository: 'repo 1', auth_required: true }]
70
+ # ]
71
+ # }
72
+
73
+ user_repo_map = { users: [] }
74
+ users.each do |user|
75
+ inner_repo_list = []
76
+ repositories = ::Katello::Repository.readable_docker_catalog_as(user)
77
+ repositories.each do |repo|
78
+ next if repo.container_repository_name.nil?
79
+ inner_repo_list << { repository: repo.container_repository_name,
80
+ auth_required: !unauthenticated_container_repositories.include?(repo.id) }
81
+ end
82
+ user_repo_map[:users] << { user.login => inner_repo_list }
83
+ end
84
+ smart_proxy.update_user_container_repo_mapping(user_repo_map)
47
85
  end
48
86
 
49
87
  def repos_to_sync(smart_proxy, environment, content_view, repository, skip_metatadata_check = false)
@@ -2,6 +2,9 @@ module Actions
2
2
  module Katello
3
3
  module ContentView
4
4
  class Promote < Actions::EntryAction
5
+ extend ApipieDSL::Class
6
+ include ::Actions::ObservableAction
7
+
5
8
  def plan(version, environments, is_force = false, description = nil, incremental_update = false)
6
9
  action_subject(version.content_view)
7
10
  version.check_ready_to_promote!(environments)
@@ -18,6 +21,28 @@ module Actions
18
21
  end
19
22
  end
20
23
  end
24
+
25
+ def environments
26
+ input['environments']
27
+ end
28
+
29
+ apipie :class, "A class representing #{self} object" do
30
+ desc 'This object is available as **@object** variable in
31
+ webhook templates when a corresponding event occures.
32
+ The following properties can be used to retrieve the needed information.'
33
+ name "#{class_scope}"
34
+ refs "#{class_scope}"
35
+ sections only: %w[all webhooks]
36
+ property :task, object_of: 'Task', desc: 'Returns the task to which this action belongs'
37
+ property :environments, array_of: String, desc: 'Returns the list of environments the content view was promoted to'
38
+ end
39
+ include Actions::Katello::JailConcern::Organization
40
+ include Actions::Katello::JailConcern::ContentView
41
+ class Jail < ::Actions::ObservableAction::Jail
42
+ allow :organization_id, :organization_name, :organization_label,
43
+ :content_view_id, :content_view_name, :content_view_label,
44
+ :environments
45
+ end
21
46
  end
22
47
  end
23
48
  end
@@ -3,7 +3,9 @@ module Actions
3
3
  module Katello
4
4
  module ContentView
5
5
  class Publish < Actions::EntryAction
6
+ extend ApipieDSL::Class
6
7
  include ::Katello::ContentViewHelper
8
+ include ::Actions::ObservableAction
7
9
  attr_accessor :version
8
10
  # rubocop:disable Metrics/MethodLength,Metrics/AbcSize,Metrics/CyclomaticComplexity
9
11
  def plan(content_view, description = "", options = {importing: false}) # rubocop:disable Metrics/PerceivedComplexity
@@ -145,6 +147,14 @@ module Actions
145
147
  rescue ::Katello::Errors::CapsuleCannotBeReached # skip any capsules that cannot be connected to
146
148
  end
147
149
 
150
+ def content_view_version_id
151
+ input['content_view_version_id']
152
+ end
153
+
154
+ def content_view_version_name
155
+ input['content_view_version_name']
156
+ end
157
+
148
158
  private
149
159
 
150
160
  def include_other_components(override_components, content_view)
@@ -197,6 +207,25 @@ module Actions
197
207
  end
198
208
  end
199
209
  end
210
+
211
+ apipie :class, "A class representing #{self} object" do
212
+ desc 'This object is available as **@object** variable in
213
+ webhook templates when a corresponding event occures.
214
+ The following properties can be used to retrieve the needed information.'
215
+ name "#{class_scope}"
216
+ refs "#{class_scope}"
217
+ sections only: %w[all webhooks]
218
+ property :task, object_of: 'Task', desc: 'Returns the task to which this action belongs'
219
+ property :content_view_version_id, Integer, desc: 'Returns published content view version id'
220
+ property :content_view_version_name, String, desc: 'Returns published content view version name'
221
+ end
222
+ include Actions::Katello::JailConcern::Organization
223
+ include Actions::Katello::JailConcern::ContentView
224
+ class Jail < ::Actions::ObservableAction::Jail
225
+ allow :organization_id, :organization_name, :organization_label,
226
+ :content_view_id, :content_view_name, :content_view_label,
227
+ :content_view_version_id, :content_view_version_name
228
+ end
200
229
  end
201
230
  end
202
231
  end
@@ -0,0 +1,30 @@
1
+ module Actions
2
+ module Katello
3
+ module JailConcern
4
+ module ContentView
5
+ def content_view_id
6
+ input['content_view']['id']
7
+ end
8
+
9
+ def content_view_name
10
+ input['content_view']['name']
11
+ end
12
+
13
+ def content_view_label
14
+ input['content_view']['label']
15
+ end
16
+
17
+ def self.included(base)
18
+ super
19
+ base.instance_eval do
20
+ apipie :class do
21
+ property :content_view_id, Integer, desc: 'Returns the id of the content view'
22
+ property :content_view_name, String, desc: 'Returns the name of the content view'
23
+ property :content_view_label, String, desc: 'Returns the label of the content view'
24
+ end
25
+ end
26
+ end
27
+ end
28
+ end
29
+ end
30
+ end
@@ -0,0 +1,30 @@
1
+ module Actions
2
+ module Katello
3
+ module JailConcern
4
+ module Organization
5
+ def organization_id
6
+ input['organization']['id']
7
+ end
8
+
9
+ def organization_name
10
+ input['organization']['name']
11
+ end
12
+
13
+ def organization_label
14
+ input['organization']['label']
15
+ end
16
+
17
+ def self.included(base)
18
+ super
19
+ base.instance_eval do
20
+ apipie :class do
21
+ property :organization_id, Integer, desc: 'Returns the id of the organization'
22
+ property :organization_name, String, desc: 'Returns the name of the organization'
23
+ property :organization_label, String, desc: 'Returns the label of the organization'
24
+ end
25
+ end
26
+ end
27
+ end
28
+ end
29
+ end
30
+ end
@@ -3,8 +3,10 @@ module Actions
3
3
  module Katello
4
4
  module Repository
5
5
  class Sync < Actions::EntryAction
6
+ extend ApipieDSL::Class
6
7
  include Helpers::Presenter
7
8
  include Actions::Katello::PulpSelector
9
+ include ::Actions::ObservableAction
8
10
  middleware.use Actions::Middleware::ExecuteIfContentsChanged
9
11
 
10
12
  input_format do
@@ -124,6 +126,63 @@ module Actions
124
126
  def rescue_strategy
125
127
  Dynflow::Action::Rescue::Skip
126
128
  end
129
+
130
+ def repository_id
131
+ input['repository']['id']
132
+ end
133
+
134
+ def repository_name
135
+ input['repository']['name']
136
+ end
137
+
138
+ def repository_label
139
+ input['repository']['label']
140
+ end
141
+
142
+ def product_id
143
+ input['product']['id']
144
+ end
145
+
146
+ def product_name
147
+ input['product']['name']
148
+ end
149
+
150
+ def product_label
151
+ input['product']['label']
152
+ end
153
+
154
+ def contents_changed
155
+ input['contents_changed']
156
+ end
157
+
158
+ def sync_result
159
+ input['sync_result']
160
+ end
161
+
162
+ apipie :class, "A class representing #{self} object" do
163
+ desc 'This object is available as **@object** variable in
164
+ webhook templates when a corresponding event occures.
165
+ The following properties can be used to retrieve the needed information.'
166
+ name "#{class_scope}"
167
+ refs "#{class_scope}"
168
+ sections only: %w[all webhooks]
169
+ property :task, object_of: 'Task', desc: 'Returns the task to which this action belongs'
170
+ property :repository_id, Integer, desc: 'Returns synced repository id'
171
+ property :repository_name, String, desc: 'Returns synced repository name'
172
+ property :repository_label, String, desc: 'Returns synced repository label'
173
+ property :product_id, Integer, desc: 'Returns product id the synced repository belongs to'
174
+ property :product_name, String, desc: 'Returns product name the synced repository belongs to'
175
+ property :product_label, String, desc: 'Returns product label the synced repository belongs to'
176
+ property :sync_result, Hash, desc: 'Returns Hash object with sync result'
177
+ property :contents_changed, one_of: [true, false], desc: 'Returns true if repository content was changed due to sync, false otherwise'
178
+ end
179
+ include Actions::Katello::JailConcern::Organization
180
+ class Jail < ::Actions::ObservableAction::Jail
181
+ allow :organization_id, :organization_name, :organization_label,
182
+ :repository_id, :repository_name, :repository_label,
183
+ :product_id, :product_name, :product_label,
184
+ :sync_result, :contents_changed
185
+ end
127
186
  end
128
187
  end
129
188
  end