foreman_scc_manager 2.0.0 → 2.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +3 -3
- data/app/controllers/api/v2/scc_accounts_controller.rb +8 -0
- data/app/controllers/scc_accounts_controller.rb +2 -0
- data/app/lib/actions/scc_manager/subscribe_product.rb +5 -7
- data/app/models/scc_account.rb +29 -0
- data/app/models/scc_product.rb +2 -5
- data/app/views/api/v2/scc_accounts/main.json.rabl +1 -1
- data/app/views/scc_accounts/_form.html.erb +8 -4
- data/db/migrate/20210713092440_add_permissions.rb +2 -2
- data/db/migrate/20221013214310_add_sync_options_to_scc_account.rb +11 -0
- data/lib/foreman_scc_manager/version.rb +1 -1
- data/locale/Makefile +9 -4
- data/locale/action_names.rb +87 -4
- data/locale/de/LC_MESSAGES/foreman_scc_manager.mo +0 -0
- data/locale/de/foreman_scc_manager.po +398 -12
- data/locale/el/LC_MESSAGES/foreman_scc_manager.mo +0 -0
- data/locale/el/foreman_scc_manager.po +595 -0
- data/locale/en/LC_MESSAGES/foreman_scc_manager.mo +0 -0
- data/locale/en/foreman_scc_manager.po +394 -8
- data/locale/foreman_scc_manager.pot +603 -47
- data/locale/ja/LC_MESSAGES/foreman_scc_manager.mo +0 -0
- data/locale/ja/foreman_scc_manager.po +598 -0
- data/locale/ka/LC_MESSAGES/foreman_scc_manager.mo +0 -0
- data/locale/ka/foreman_scc_manager.po +595 -0
- data/locale/zh_CN/LC_MESSAGES/foreman_scc_manager.mo +0 -0
- data/locale/zh_CN/foreman_scc_manager.po +598 -0
- data/test/controllers/scc_accounts_controller_test.rb +1 -1
- data/test/fixtures/models/katello_root_repositories.yml +0 -12
- data/test/test_plugin_helper.rb +0 -6
- metadata +26 -31
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: cf29760fbadb5ab05822159701061bb43f6fce7a94ada64681af0defe0e8056b
|
4
|
+
data.tar.gz: 29e94a2c06159687fe610ff3e0961f3062c1f507be5ba58efdc2487e67be998c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0b2624ad1fe80b4200c892c9988c021cf91033879003abb5074ebd3c21bb0481d8ccdf3da86e5d5a11ae354c46540e3160e289bafe3355b522bfe239bb9be264
|
7
|
+
data.tar.gz: c8446acc052cf2c38147093a26024a51c2e0da6abe9712dccb6e786eba50db6d7fba85acf4c685f423d8b9e789c75e1899bbba0fcf005642b76c7d793a94be8c
|
data/README.md
CHANGED
@@ -11,7 +11,7 @@ Foreman plugin to sync SUSE Customer Center products and repositories into Katel
|
|
11
11
|
This plugin installation is supported since Foreman 3.4 / Katello 4.6 by the foreman-installer, but only with the scenario Katello:
|
12
12
|
|
13
13
|
```sh
|
14
|
-
foreman-
|
14
|
+
foreman-installer --scenario katello --enable-foreman-plugin-scc-manager
|
15
15
|
```
|
16
16
|
|
17
17
|
You can also install it manually:
|
@@ -26,7 +26,7 @@ foreman-installer
|
|
26
26
|
|
27
27
|
| Foreman Version | Katello Version | Plugin Version |
|
28
28
|
| --------------- | --------------- | -------------- |
|
29
|
-
| 3.
|
29
|
+
| 3.3 | 4.5 | ~> 2.0.0 |
|
30
30
|
| 3.1 | 4.3 | ~> 1.8.20\* |
|
31
31
|
| 3.0 | 4.2 | ~> 1.8.20 |
|
32
32
|
| 2.5 | 4.1 | ~> 1.8.20 |
|
@@ -39,7 +39,7 @@ foreman-installer
|
|
39
39
|
|
40
40
|
## Documentation
|
41
41
|
|
42
|
-
[Plugin documentation](https://docs.
|
42
|
+
[Plugin documentation](https://docs.theforeman.org/nightly/Managing_Content/index-katello.html#Managing_SUSE_Content_content-management)
|
43
43
|
|
44
44
|
## Hammer CLI Extension
|
45
45
|
|
@@ -34,6 +34,14 @@ module Api
|
|
34
34
|
param :password, String, :required => true, :desc => N_('Password of scc_account')
|
35
35
|
param :base_url, String, :required => false, :desc => N_('URL of SUSE for scc_account')
|
36
36
|
param :interval, ['never', 'daily', 'weekly', 'monthly'], :desc => N_('Interval for syncing scc_account')
|
37
|
+
param :download_policy,
|
38
|
+
::Katello::RootRepository::DOWNLOAD_POLICIES,
|
39
|
+
:required => false,
|
40
|
+
:desc => N_('The default download policy for repositories which were created using this SCC Account.')
|
41
|
+
param :mirroring_policy,
|
42
|
+
SccAccount::SCC_MIRRORING_POLICIES,
|
43
|
+
:required => false,
|
44
|
+
:desc => N_('The default mirroring policy for repositories which were created using this SCC Account.')
|
37
45
|
param :sync_date, String, :desc => N_('Date and time relative to which the sync interval is run')
|
38
46
|
param :katello_gpg_key_id, :identifier, :required => false, :desc => N_('Associated GPG key of scc_account')
|
39
47
|
end
|
@@ -53,7 +53,9 @@ module Actions
|
|
53
53
|
:pretty_repo_name => repo.pretty_name,
|
54
54
|
:url => repo.url,
|
55
55
|
:token => repo.token,
|
56
|
-
:arch => arch
|
56
|
+
:arch => arch,
|
57
|
+
:download_policy => scc_product.scc_account.download_policy,
|
58
|
+
:mirroring_policy => scc_product.scc_account.mirroring_policy)
|
57
59
|
katello_repos[repo.id] = repo_create_action.output[:katello_root_repository_id]
|
58
60
|
end
|
59
61
|
|
@@ -119,13 +121,9 @@ module Actions
|
|
119
121
|
:unprotected => unprotected,
|
120
122
|
:gpg_key => gpg_key,
|
121
123
|
:arch => input[:arch],
|
122
|
-
:download_policy =>
|
124
|
+
:download_policy => input[:download_policy],
|
125
|
+
:mirroring_policy => input[:mirroring_policy] }
|
123
126
|
repository = product.add_repo(repo_param)
|
124
|
-
if repository.has_attribute?('mirror_on_sync')
|
125
|
-
repository.mirror_on_sync = true
|
126
|
-
else
|
127
|
-
repository.mirroring_policy = ::Katello::RootRepository::MIRRORING_POLICY_CONTENT
|
128
|
-
end
|
129
127
|
if repository.has_attribute?('upstream_authentication_token')
|
130
128
|
repository.url = input[:url]
|
131
129
|
repository.upstream_authentication_token = input[:token]
|
data/app/models/scc_account.rb
CHANGED
@@ -13,6 +13,11 @@ class SccAccount < ApplicationRecord
|
|
13
13
|
MONTHLY = 'monthly'.freeze
|
14
14
|
TYPES = [NEVER, DAILY, WEEKLY, MONTHLY].freeze
|
15
15
|
|
16
|
+
# MIRRORING_POLICY_COMPLETE doesn't work for suse repository because deltarpm metadata is not supported by pulp3
|
17
|
+
SCC_MIRRORING_POLICIES = ::Katello::RootRepository::MIRRORING_POLICIES.dup
|
18
|
+
SCC_MIRRORING_POLICIES.delete(::Katello::RootRepository::MIRRORING_POLICY_COMPLETE)
|
19
|
+
SCC_MIRRORING_POLICIES.freeze
|
20
|
+
|
16
21
|
self.include_root_in_json = false
|
17
22
|
|
18
23
|
belongs_to :organization
|
@@ -29,6 +34,8 @@ class SccAccount < ApplicationRecord
|
|
29
34
|
validates :password, presence: true
|
30
35
|
validates :base_url, presence: true
|
31
36
|
validates :interval, :inclusion => { :in => TYPES }, :allow_blank => false
|
37
|
+
validates :download_policy, :inclusion => { :in => ::Katello::RootRepository::DOWNLOAD_POLICIES }, :allow_blank => false
|
38
|
+
validates :mirroring_policy, :inclusion => { :in => SCC_MIRRORING_POLICIES }, :allow_blank => false
|
32
39
|
validate :sync_date_is_valid_datetime
|
33
40
|
|
34
41
|
after_initialize :init
|
@@ -278,4 +285,26 @@ class SccAccount < ApplicationRecord
|
|
278
285
|
end
|
279
286
|
items_to_invalidate
|
280
287
|
end
|
288
|
+
|
289
|
+
def self.download_policy_selection_values
|
290
|
+
names = {
|
291
|
+
::Katello::RootRepository::DOWNLOAD_ON_DEMAND => _('On Demand'),
|
292
|
+
::Katello::RootRepository::DOWNLOAD_IMMEDIATE => _('Immediate')
|
293
|
+
}
|
294
|
+
|
295
|
+
::Katello::RootRepository::DOWNLOAD_POLICIES.map do |p|
|
296
|
+
[names.fetch(p, p), p]
|
297
|
+
end
|
298
|
+
end
|
299
|
+
|
300
|
+
def self.mirroring_policy_selection_values
|
301
|
+
names = {
|
302
|
+
::Katello::RootRepository::MIRRORING_POLICY_ADDITIVE => _('Additive'),
|
303
|
+
::Katello::RootRepository::MIRRORING_POLICY_CONTENT => _('Content Only')
|
304
|
+
}
|
305
|
+
|
306
|
+
::Katello::RootRepository::MIRRORING_POLICIES.map do |p|
|
307
|
+
[names.fetch(p, p), p]
|
308
|
+
end
|
309
|
+
end
|
281
310
|
end
|
data/app/models/scc_product.rb
CHANGED
@@ -58,11 +58,8 @@ class SccProduct < ApplicationRecord
|
|
58
58
|
gpg_key = new_product.gpg_key
|
59
59
|
new_repo = new_product.add_repo(label, uniq_repo_name, repo.url, 'yum', unprotected, gpg_key)
|
60
60
|
new_repo.arch = arch || 'noarch'
|
61
|
-
|
62
|
-
|
63
|
-
else
|
64
|
-
new_repo.mirroring_policy = ::Katello::RootRepository::MIRRORING_POLICY_CONTENT
|
65
|
-
end
|
61
|
+
new_repo.mirroring_policy = scc_account.mirroring_policy
|
62
|
+
new_repo.download_policy = scc_account.download_policy
|
66
63
|
if new_repo.has_attribute?('upstream_authentication_token')
|
67
64
|
new_repo.upstream_authentication_token = repo.token
|
68
65
|
new_repo.url = repo.url
|
@@ -2,4 +2,4 @@
|
|
2
2
|
|
3
3
|
object @scc_account
|
4
4
|
extends 'api/v2/scc_accounts/base'
|
5
|
-
attributes :organization_id, :organization_name, :login, :base_url, :interval, :sync_date
|
5
|
+
attributes :organization_id, :organization_name, :login, :base_url, :interval, :download_policy, :mirroring_policy, :sync_date
|
@@ -19,11 +19,15 @@
|
|
19
19
|
<%= field f, :sync_date, label: _('Sync Date') do
|
20
20
|
f.datetime_field :sync_date, placeholder: Time.now
|
21
21
|
end %>
|
22
|
-
<%= selectable_f f, :katello_gpg_key_id, @selectable_gpg_keys, {},
|
23
|
-
{ :include_blank => _("None"),
|
24
|
-
:label => _('Use GPG key for SUSE products'),
|
25
|
-
:selected => @scc_account.katello_gpg_key_id,
|
22
|
+
<%= selectable_f f, :katello_gpg_key_id, @selectable_gpg_keys, {},
|
23
|
+
{ :include_blank => _("None"),
|
24
|
+
:label => _('Use GPG key for SUSE products'),
|
25
|
+
:selected => @scc_account.katello_gpg_key_id,
|
26
26
|
:help_block => _("Use this setting if you want to automatically add a GPG key to your SUSE products upon subscription. You can change this setting in the 'Content' > 'Products' menu, later.") } %>
|
27
|
+
<%= selectable_f f, :download_policy, SccAccount::download_policy_selection_values,
|
28
|
+
{ :label => _('Download Policy'), :help_block => _("The default download policy for repositories which were created using this SCC Account.") } %>
|
29
|
+
<%= selectable_f f, :mirroring_policy, SccAccount::mirroring_policy_selection_values,
|
30
|
+
{ :label => _('Mirroring Policy'), :help_block => _("The default mirroring policy for repositories which were created using this SCC Account.") } %>
|
27
31
|
<div class='clearfix'>
|
28
32
|
<div class='form-group'>
|
29
33
|
<div class='col-md-2'></div>
|
@@ -5,9 +5,9 @@ class AddPermissions < ActiveRecord::Migration[6.0]
|
|
5
5
|
].freeze
|
6
6
|
|
7
7
|
def up
|
8
|
-
Permission.
|
8
|
+
Permission.find_or_create_by!(:name => 'test_connection_scc_accounts', :resource_type => 'SccAccount')
|
9
9
|
PRODUCT_PERMISSION_NAMES.each do |p|
|
10
|
-
Permission.
|
10
|
+
Permission.find_or_create_by!(:name => p, :resource_type => 'SccProduct')
|
11
11
|
end
|
12
12
|
end
|
13
13
|
|
@@ -0,0 +1,11 @@
|
|
1
|
+
class AddSyncOptionsToSccAccount < ActiveRecord::Migration[5.2]
|
2
|
+
def change
|
3
|
+
add_column :scc_accounts, :download_policy, :string, default: ::Katello::RootRepository::DOWNLOAD_IMMEDIATE
|
4
|
+
add_column :scc_accounts, :mirroring_policy, :string, default: ::Katello::RootRepository::MIRRORING_POLICY_CONTENT
|
5
|
+
SccAccount.all.each do |a|
|
6
|
+
a.download_policy = ::Katello::RootRepository::DOWNLOAD_IMMEDIATE
|
7
|
+
a.mirroring_policy = ::Katello::RootRepository::MIRRORING_POLICY_CONTENT
|
8
|
+
a.save!
|
9
|
+
end
|
10
|
+
end
|
11
|
+
end
|
data/locale/Makefile
CHANGED
@@ -6,8 +6,8 @@
|
|
6
6
|
# make tx-update - download and merge translations from Transifex
|
7
7
|
# make clean - clean everything
|
8
8
|
#
|
9
|
-
DOMAIN =
|
10
|
-
VERSION = $(shell ruby -e '
|
9
|
+
DOMAIN = $(shell ruby -rrubygems -e 'puts Gem::Specification::load(Dir.glob("../*.gemspec")[0]).name')
|
10
|
+
VERSION = $(shell ruby -rrubygems -e 'puts Gem::Specification::load(Dir.glob("../*.gemspec")[0]).version')
|
11
11
|
POTFILE = $(DOMAIN).pot
|
12
12
|
MOFILE = $(DOMAIN).mo
|
13
13
|
POFILES = $(shell find . -name '$(DOMAIN).po')
|
@@ -41,7 +41,10 @@ uniq-po:
|
|
41
41
|
msguniq $$f -o $$f ; \
|
42
42
|
done
|
43
43
|
|
44
|
-
tx-
|
44
|
+
tx-new:
|
45
|
+
tx pull --minimum-perc 50 --all
|
46
|
+
|
47
|
+
tx-pull: tx-new $(EDITFILES)
|
45
48
|
tx pull -f
|
46
49
|
for f in $(EDITFILES) ; do \
|
47
50
|
sed -i 's/^\("Project-Id-Version: \).*$$/\1$(DOMAIN) $(VERSION)\\n"/' $$f; \
|
@@ -52,7 +55,9 @@ tx-update: tx-pull
|
|
52
55
|
@echo Run rake plugin:gettext[$(DOMAIN)] from the Foreman installation, then make -C locale mo-files to finish
|
53
56
|
@echo
|
54
57
|
|
55
|
-
mo-files: $(MOFILES)
|
58
|
+
build-mo-files: $(MOFILES)
|
59
|
+
|
60
|
+
mo-files: build-mo-files
|
56
61
|
git add $(POFILES) $(POTFILE) ../locale/*/LC_MESSAGES
|
57
62
|
git commit -m "i18n - pulling from tx"
|
58
63
|
@echo
|
data/locale/action_names.rb
CHANGED
@@ -1,5 +1,88 @@
|
|
1
|
-
|
2
|
-
_("
|
3
|
-
_("
|
4
|
-
_("
|
1
|
+
# Autogenerated!
|
2
|
+
_("Import")
|
3
|
+
_("Export Repository")
|
4
|
+
_("Export Library")
|
5
|
+
_("Generate host applicability")
|
6
|
+
_("Bulk generate applicability for hosts")
|
7
|
+
_("Generate repository applicability")
|
8
|
+
_("Synchronize smart proxy")
|
9
|
+
_("Sync capsule")
|
10
|
+
_("Update CDN Configuration")
|
11
|
+
_("Update")
|
12
|
+
_("Delete")
|
13
|
+
_("Errata mail")
|
14
|
+
_("Incremental Update of Content View Version(s) ")
|
15
|
+
_("Import facts")
|
16
|
+
_("Import Puppet classes")
|
17
|
+
_("Abstract async task")
|
18
|
+
_("Syncable export")
|
19
|
+
_("Export")
|
20
|
+
_("Copy version units to library")
|
21
|
+
_("Create Syncable Export History")
|
22
|
+
_("Create Import History")
|
23
|
+
_("Create")
|
24
|
+
_("Delete Activation Key")
|
25
|
+
_("Create Export History")
|
26
|
+
_("Agent action")
|
27
|
+
_("Create Alternate Content Source")
|
28
|
+
_("Destroy Alternate Content Source")
|
29
|
+
_("Refresh Alternate Content Source")
|
30
|
+
_("Update Alternate Content Source")
|
31
|
+
_("Action with sub plans")
|
32
|
+
_("Abstract")
|
33
|
+
_("Remove from Environment")
|
34
|
+
_("Promote")
|
35
|
+
_("Promotion to Environment")
|
36
|
+
_("Publish")
|
37
|
+
_("Remove Versions and Associations")
|
38
|
+
_("Remove Version")
|
39
|
+
_("Import Content View Version")
|
40
|
+
_("Import Default Content View")
|
41
|
+
_("Import Repository")
|
42
|
+
_("Incremental Update")
|
43
|
+
_("Republish Version Repositories")
|
44
|
+
_("Delete Lifecycle Environment")
|
45
|
+
_("Publish Lifecycle Environment Repositories")
|
46
|
+
_("Attach subscriptions")
|
47
|
+
_("Auto attach subscriptions")
|
48
|
+
_("Destroy Content Host")
|
49
|
+
_("Install Applicable Errata")
|
50
|
+
_("Hypervisors")
|
51
|
+
_("Hypervisors update")
|
52
|
+
_("Remove subscriptions")
|
53
|
+
_("Combined Profile Update")
|
54
|
+
_("Update Content Overrides")
|
55
|
+
_("Update for host")
|
56
|
+
_("Update release version for host")
|
57
|
+
_("Updating System Purpose for host")
|
58
|
+
_("Package Profile Update")
|
59
|
+
_("Destroy")
|
60
|
+
_("Run Sync Plan:")
|
61
|
+
_("Enable")
|
62
|
+
_("Disable")
|
63
|
+
_("Verify checksum")
|
64
|
+
_("Create Package Group")
|
65
|
+
_("Upload into")
|
66
|
+
_("Update redhat repository")
|
67
|
+
_("Update http proxy details")
|
68
|
+
_("Update content urls")
|
69
|
+
_("Discover")
|
70
|
+
_("Synchronize")
|
71
|
+
_("Remove Content")
|
72
|
+
_("Instance update")
|
73
|
+
_("Index package groups")
|
74
|
+
_("Index module streams")
|
75
|
+
_("Index errata")
|
76
|
+
_("Index content")
|
77
|
+
_("Filtered index content")
|
78
|
+
_("Fetch pxe files")
|
79
|
+
_("Delete Package Group")
|
80
|
+
_("Update http proxy")
|
81
|
+
_("Reindex subscriptions")
|
82
|
+
_("Delete Product")
|
83
|
+
_("Product Create")
|
5
84
|
_("Sync SUSE subscriptions (Repositories)")
|
85
|
+
_("Sync SUSE subscriptions (Products)")
|
86
|
+
_("Update SUSE repositories")
|
87
|
+
_("Sync SUSE subscriptions")
|
88
|
+
_("Subscribe SCC Product")
|
Binary file
|