Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use the yumrepo type to manage the repository & expose more params #320

Merged
merged 2 commits into from Nov 17, 2023

Conversation

ekohl
Copy link
Member

@ekohl ekohl commented Nov 16, 2023

This drops module_hotfixes=1 since the repository now presents proper modular metadata. It also stops managing the pulpcore-source repository, but it was enforces to be disabled anyway.

The parameters can be used to test from staging repositories or a local mirror. It's an alternative to #319.

This drops module_hotfixes=1 since the repository now presents proper
modular metadata. It also stops managing the pulpcore-source repository,
but it was enforces to be disabled anyway.
@ehelms
Copy link
Member

ehelms commented Nov 16, 2023

Here is a diff to update tests:

diff --git a/.fixtures.yml b/.fixtures.yml
index 3a8278e..4ab9c3c 100644
--- a/.fixtures.yml
+++ b/.fixtures.yml
@@ -13,3 +13,4 @@ fixtures:
       puppet_version: '>= 6.0.0'
     stdlib:           'https://github.com/puppetlabs/puppetlabs-stdlib'
     systemd:          'https://github.com/voxpupuli/puppet-systemd'
+    yumrepo_core: 'https://github.com/puppetlabs/puppetlabs-yumrepo_core'
diff --git a/spec/classes/repo_spec.rb b/spec/classes/repo_spec.rb
index 0da9730..384e2e7 100644
--- a/spec/classes/repo_spec.rb
+++ b/spec/classes/repo_spec.rb
@@ -7,12 +7,13 @@ describe 'pulpcore::repo' do
 
       describe "with default values" do
         it { is_expected.to compile.with_all_deps }
-        it do
-          is_expected.to contain_anchor('pulpcore::repo')
-          is_expected.to contain_file('/etc/yum.repos.d/pulpcore.repo')
-            .with_content(%r{^baseurl=https://yum.theforeman.org/pulpcore/\d+\.\d+/el\d+/\$basearch$})
-            .that_notifies('Anchor[pulpcore::repo]')
-        end
+        it { is_expected.to contain_anchor('pulpcore::repo') }
+        it { is_expected.to contain_yumrepo('pulpcore')
+          .with_baseurl(%r{https://yum.theforeman.org/pulpcore/\d+\.\d+/el\d+/\$basearch$})
+          .with_gpgcheck(1)
+          .with_gpgkey(%r{https://yum.theforeman.org/pulpcore/\d+\.\d+/GPG-RPM-KEY-pulpcore})
+          .that_notifies('Anchor[pulpcore::repo]')
+        }
 
         if os_facts[:os]['release']['major'] == '8'
           it 'configures the pulpcore module' do
@@ -21,7 +22,7 @@ describe 'pulpcore::repo' do
               .with_ensure(/^el\d+/)
               .with_enable_only(true)
               .with_provider('dnfmodule')
-              .that_requires('File[/etc/yum.repos.d/pulpcore.repo]')
+              .that_requires('Yumrepo[pulpcore]')
               .that_notifies('Anchor[pulpcore::repo]')
           end
         else
@@ -32,16 +33,17 @@ describe 'pulpcore::repo' do
       describe "with nightly version" do
         let :params do
           {
-            version: 'nightly'
+            version: 'nightly',
+            gpgkey: '',
           }
         end
 
         it { is_expected.to compile.with_all_deps }
-        it do
-          is_expected.to contain_file('/etc/yum.repos.d/pulpcore.repo')
-            .with_content(%r{^baseurl=https://yum.theforeman.org/pulpcore/nightly/el\d+/\$basearch$})
-            .that_notifies('Anchor[pulpcore::repo]')
-        end
+        it { is_expected.to contain_yumrepo('pulpcore')
+          .with_baseurl(%r{https://yum.theforeman.org/pulpcore/nightly/el\d+/\$basearch$})
+          .with_gpgcheck(0)
+          .that_notifies('Anchor[pulpcore::repo]')
+        }
       end
     end
   end

This can be used to test from staging repositories or a local mirror.

Co-Authored-By: Eric D. Helms <ericdhelms@gmail.com>
@evgeni evgeni added the Enhancement New feature or request label Nov 17, 2023
@evgeni evgeni enabled auto-merge (rebase) November 17, 2023 08:16
@evgeni evgeni merged commit fa2bd4f into theforeman:master Nov 17, 2023
3 of 17 checks passed
@evgeni
Copy link
Member

evgeni commented Nov 17, 2023

WHY GITHUB, WHY
IT FAILED

@evgeni evgeni mentioned this pull request Nov 17, 2023
@ekohl ekohl deleted the switch-back-to-yumrepo branch November 17, 2023 10:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants