Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ class { 'rhsm':
Use `rh_repo` type to add a repository:

```puppet
rh_repo { 'rhel-7-server-extras-rpms':
rh_repo { 'codeready-builder-for-rhel-8-x86_64-rpms':
ensure => present,
}
```
Expand Down Expand Up @@ -101,9 +101,9 @@ class { 'rhsm':
rh_user => 'myuser',
rh_password => 'mypassword',
enabled_repo_ids => [
'rhel-7-server-rpms',
'rhel-7-server-optional-rpms'
]
'rhel-8-for-x86_64-baseos-rpms',
'rhel-8-for-x86_64-appstream-rpms',
],
}
```

Expand All @@ -113,16 +113,16 @@ Alternatively, hiera can be utilized to specify these arguments.
rhsm::rh_user: myuser
rhsm::rh_password: mypassword
rhsm::enabled_repo_ids:
- 'rhel-7-server-rpms',
- 'rhel-7-server-optional-rpms'
- 'rhel-8-for-x86_64-baseos-rpms'
- 'rhel-8-for-x86_64-appstream-rpms'
```

### Satellite 6
Registering with Red Hat Satellite 6 needs some additional settings.

```puppet
class { 'rhsm':
activationkey => 'act-lce-rhel-7,act-product',
activationkey => 'act-lce-rhel-8,act-product',
org => 'satellite_organization',
servername => 'satellite.example.com',
serverprefix => '/rhsm',
Expand Down
6 changes: 1 addition & 5 deletions manifests/init.pp
Original file line number Diff line number Diff line change
Expand Up @@ -173,11 +173,7 @@
}

unless empty($plugin_settings) {
if $facts['os']['release']['major'] < '8' {
$plugin_path = '/etc/yum/pluginconf.d/subscription-manager.conf'
} else {
$plugin_path = '/etc/dnf/plugins/subscription-manager.conf'
}
$plugin_path = '/etc/dnf/plugins/subscription-manager.conf'

file { $plugin_path:
ensure => 'file',
Expand Down
2 changes: 0 additions & 2 deletions metadata.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,6 @@
{
"operatingsystem": "RedHat",
"operatingsystemrelease": [
"6",
"7",
"8"
]
}
Expand Down
54 changes: 15 additions & 39 deletions spec/classes/init_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -38,24 +38,13 @@
)
end

if facts[:os]['family'] == 'RedHat' && facts[:os]['release']['major'] < '8'
it do
is_expected.to contain_file('/etc/yum/pluginconf.d/subscription-manager.conf').
with_owner('root').
with_group('root').
with_mode('0644').
with_content(%r{^\[main\]$}).
with_content(%r{^enabled=1$})
end
else
it do
is_expected.to contain_file('/etc/dnf/plugins/subscription-manager.conf').
with_owner('root').
with_group('root').
with_mode('0644').
with_content(%r{^\[main\]$}).
with_content(%r{^enabled=1$})
end
it do
is_expected.to contain_file('/etc/dnf/plugins/subscription-manager.conf').
with_owner('root').
with_group('root').
with_mode('0644').
with_content(%r{^\[main\]$}).
with_content(%r{^enabled=1$})
end
end

Expand Down Expand Up @@ -160,27 +149,14 @@
is_expected.not_to contain_file('/etc/yum.repos.d/redhat.repo')
end

if facts[:os]['family'] == 'RedHat' && facts[:os]['release']['major'] < '8'
# disable_system_repos doesn't actually do anything on EL6 or 7
it do
is_expected.to contain_file('/etc/yum/pluginconf.d/subscription-manager.conf').
with_owner('root').
with_group('root').
with_mode('0644').
with_content(%r{^\[main\]$}).
with_content(%r{^enabled=0$}).
with_content(%r{^disable_system_repos=1$})
end
else
it do
is_expected.to contain_file('/etc/dnf/plugins/subscription-manager.conf').
with_owner('root').
with_group('root').
with_mode('0644').
with_content(%r{^\[main\]$}).
with_content(%r{^enabled=0$}).
with_content(%r{^disable_system_repos=1$})
end
it do
is_expected.to contain_file('/etc/dnf/plugins/subscription-manager.conf').
with_owner('root').
with_group('root').
with_mode('0644').
with_content(%r{^\[main\]$}).
with_content(%r{^enabled=0$}).
with_content(%r{^disable_system_repos=1$})
end
end
end
Expand Down