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

mirror_on_sync is deprecated #1388

Closed
gvde opened this issue Apr 27, 2022 · 8 comments · Fixed by #1392
Closed

mirror_on_sync is deprecated #1388

gvde opened this issue Apr 27, 2022 · 8 comments · Fixed by #1392

Comments

@gvde
Copy link
Contributor

gvde commented Apr 27, 2022

SUMMARY

Running against a katello 4.3 or 4.4 server my playbook always wants to add

+            "mirror_on_sync": true,

to all of my repositories. However, mirror_on_sync has been deprecated and replaced by mirroring_policy.

ANSIBLE VERSION
$ ansible --version
ansible 2.9.27
  config file = /home/k/k111111/git/foreman-ansible/ansible.cfg
  configured module search path = ['/home/k/k111111/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/lib/python3.6/site-packages/ansible
  executable location = /usr/bin/ansible
  python version = 3.6.8 (default, Nov 17 2021, 16:10:06) [GCC 8.5.0 20210514 (Red Hat 8.5.0-3)]
COLLECTION VERSION
$ ansible-galaxy collection list
usage: ansible-galaxy collection [-h] COLLECTION_ACTION ...
ansible-galaxy collection: error: argument COLLECTION_ACTION: invalid choice: 'list' (choose from 'init', 'build', 'publish', 'install')

Well, initially I have used the rpm ansible-collection-theforeman-foreman-3.1.0-2.el8.noarch, then I have tried the latest version from ansible-galaxy.

KATELLO/FOREMAN VERSION
katello-4.4.0-1.el8.noarch
foreman-3.2.0-1.el8.noarch
STEPS TO REPRODUCE

Set any repository using theforeman.foreman.repository.

EXPECTED RESULTS

Don't make any changes on the second run.

ACTUAL RESULTS

It keeps changing this, for example:

--- before
+++ after
@@ -5,17 +5,14 @@
             "content_type": "yum",
             "download_policy": "immediate",
             "gpg_key_id": 5,
-            "http_proxy_id": null,
             "http_proxy_policy": "global_default_http_proxy",
             "id": 112,
             "label": "puppet6_el8_x86_64",
+            "mirror_on_sync": true,
             "name": "Puppet 6 Repository el 8 - x86_64",
             "organization_id": 1,
             "os_versions": [],
             "product_id": 131,
-            "ssl_ca_cert_id": null,
-            "ssl_client_cert_id": null,
-            "ssl_client_key_id": null,
             "unprotected": true,
             "url": "http://yum.puppetlabs.com/puppet6/el/8/x86_64/",
             "verify_ssl_on_sync": true
@evgeni
Copy link
Member

evgeni commented Apr 29, 2022

Hey @gvde, thanks for the report!

Would you mind having a look at #1392?

evgeni added a commit to evgeni/foreman-ansible-modules that referenced this issue Apr 29, 2022
evgeni added a commit to evgeni/foreman-ansible-modules that referenced this issue Apr 29, 2022
@gvde
Copy link
Contributor Author

gvde commented Apr 29, 2022

Would you mind having a look at #1392?

@evgeni Thanks. Looks good to me. But it's not only for Katello 4.4 but also for 4.3. The new mirroring policy has been introduced with 4.3.

@evgeni
Copy link
Member

evgeni commented Apr 29, 2022

Ah, indeed. Didn't notice it was picked back. Will update the docs.

evgeni added a commit to evgeni/foreman-ansible-modules that referenced this issue Apr 29, 2022
@gvde
Copy link
Contributor Author

gvde commented Jun 13, 2022

Ah, indeed. Didn't notice it was picked back. Will update the docs.

@evgeni I am somewhat confused right now. I have 3.4.0 installed but I just ran my playbook again and it wants to set mirror_on_sync on all my repositories even though it has a mirroring_policy already set.

--- before
+++ after
@@ -8,6 +8,7 @@
             "http_proxy_policy": "global_default_http_proxy",
             "id": 10,
             "label": "AppStream_x86_64_os",
+            "mirror_on_sync": true,
             "mirroring_policy": "mirror_content_only",
             "name": "AlmaLinux-8 - AppStream x86_64 os",
             "organization_id": 1,

@evgeni
Copy link
Member

evgeni commented Jun 13, 2022

@gvde without seeing the playbook, it's hard to say ;)

@gvde
Copy link
Contributor Author

gvde commented Jun 13, 2022

@evgeni Oh. I thought it was in the initial post...

---
- name: configure foreman server
  hosts: foreman
  gather_facts: false

  roles:
    - role: theforeman.foreman.repositories
      vars:
        foreman_products:
          - name: "AlmaLinux 8"
            label: "almalinux8"
            gpg_key: RPM-GPG-KEY-AlmaLinux
            repositories:
              - name: "AlmaLinux-8 - extras x86_64 os"
                label: "extras_x86_64_os"
                mirroring_policy: "mirror_content_only"
                content_type: yum
                url: https://repo.almalinux.org/almalinux/8/extras/x86_64/os/
                gpg_key: RPM-GPG-KEY-AlmaLinux
              - name: "AlmaLinux-8 - PowerTools x86_64 os"
                label: "PowerTools_x86_64_os"
                mirroring_policy: "mirror_content_only"
                content_type: yum
                url: https://repo.almalinux.org/almalinux/8/PowerTools/x86_64/os/
                gpg_key: RPM-GPG-KEY-AlmaLinux

Whenever I run it I get this:

TASK [theforeman.foreman.repositories : Create Repositories] *******************************************************************************************************************************
--- before
+++ after
@@ -8,6 +8,7 @@
             "http_proxy_policy": "global_default_http_proxy",
             "id": 6,
             "label": "extras_x86_64_os",
+            "mirror_on_sync": true,
             "mirroring_policy": "mirror_content_only",
             "name": "AlmaLinux-8 - extras x86_64 os",
             "organization_id": 1,

changed: [foreman8.example.com] => (item=[{'name': 'AlmaLinux 8', 'label': 'almalinux8', 'gpg_key': 'RPM-GPG-KEY-AlmaLinux'}, {'name': 'AlmaLinux-8 - extras x86_64 os', 'label': 'extras_x86_64_os', 'mirroring_policy': 'mirror_content_only', 'content_type': 'yum', 'url': 'https://repo.almalinux.org/almalinux/8/extras/x86_64/os/', 'gpg_key': 'RPM-GPG-KEY-AlmaLinux'}])
--- before
+++ after
@@ -8,6 +8,7 @@
             "http_proxy_policy": "global_default_http_proxy",
             "id": 7,
             "label": "PowerTools_x86_64_os",
+            "mirror_on_sync": true,
             "mirroring_policy": "mirror_content_only",
             "name": "AlmaLinux-8 - PowerTools x86_64 os",
             "organization_id": 1,

changed: [foreman8.example.com] => (item=[{'name': 'AlmaLinux 8', 'label': 'almalinux8', 'gpg_key': 'RPM-GPG-KEY-AlmaLinux'}, {'name': 'AlmaLinux-8 - PowerTools x86_64 os', 'label': 'PowerTools_x86_64_os', 'mirroring_policy': 'mirror_content_only', 'content_type': 'yum', 'url': 'https://repo.almalinux.org/almalinux/8/PowerTools/x86_64/os/', 'gpg_key': 'RPM-GPG-KEY-AlmaLinux'}])

I have stripped it down here to these two repos, but all are affected.

@evgeni
Copy link
Member

evgeni commented Jun 13, 2022

Is that with or without #1419?

@gvde
Copy link
Contributor Author

gvde commented Jun 13, 2022

OMG. By now I have so many issues open, so many hotfixes and workarounds implemented to get it properly working until the issues have been properly resolved, that I am actually loosing the track... With #1419 of course, it won't complain about changes anymore. I have assumed this was already in with #1392...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants