diff --git a/changelogs/fragments/3237-copr-fix_chroot_naming.yml b/changelogs/fragments/3237-copr-fix_chroot_naming.yml new file mode 100644 index 0000000000..7a942bc94e --- /dev/null +++ b/changelogs/fragments/3237-copr-fix_chroot_naming.yml @@ -0,0 +1,2 @@ +bugfixes: + - copr - fix chroot naming issues, ``centos-stream`` changed naming to ``centos-stream-`` (for exmaple ``centos-stream-8``) (https://github.com/ansible-collections/community.general/issues/2084, https://github.com/ansible-collections/community.general/pull/3237). \ No newline at end of file diff --git a/plugins/modules/packaging/os/copr.py b/plugins/modules/packaging/os/copr.py index 4bf665e045..cb31e8c9fb 100644 --- a/plugins/modules/packaging/os/copr.py +++ b/plugins/modules/packaging/os/copr.py @@ -120,8 +120,7 @@ class CoprModule(object): @property def short_chroot(self): """str: Chroot (distribution-version-architecture) shorten to distribution-version.""" - chroot_parts = self.chroot.split("-") - return "{0}-{1}".format(chroot_parts[0], chroot_parts[1]) + return self.chroot.rsplit('-', 1)[0] @property def arch(self): @@ -193,18 +192,20 @@ class CoprModule(object): Returns: Information about the repository. """ - distribution, version = self.short_chroot.split("-") + distribution, version = self.short_chroot.split('-', 1) chroot = self.short_chroot while True: repo_info, status_code = self._get(chroot) if repo_info: return repo_info if distribution == "rhel": - chroot = "centos-stream" + chroot = "centos-stream-8" distribution = "centos" elif distribution == "centos": - if version == "stream": + if version == "stream-8": version = "8" + elif version == "stream-9": + version = "9" chroot = "epel-{0}".format(version) distribution = "epel" else: diff --git a/tests/integration/targets/copr/aliases b/tests/integration/targets/copr/aliases index fbe7da85db..0ad5e1c80c 100644 --- a/tests/integration/targets/copr/aliases +++ b/tests/integration/targets/copr/aliases @@ -3,4 +3,3 @@ needs/root skip/macos skip/osx skip/freebsd -disabled # FIXME diff --git a/tests/integration/targets/copr/tasks/main.yml b/tests/integration/targets/copr/tasks/main.yml index 32ce67208d..1c8afd992f 100644 --- a/tests/integration/targets/copr/tasks/main.yml +++ b/tests/integration/targets/copr/tasks/main.yml @@ -6,7 +6,7 @@ host: copr.fedorainfracloud.org state: enabled name: '@copr/integration_tests' - chroot: centos-stream-x86_64 + chroot: fedora-rawhide-x86_64 register: result - name: assert that the copr project was enabled @@ -21,7 +21,7 @@ copr: state: enabled name: '@copr/integration_tests' - chroot: centos-stream-x86_64 + chroot: fedora-rawhide-x86_64 register: result - name: assert that the copr project was enabled @@ -46,7 +46,7 @@ copr: state: disabled name: '@copr/integration_tests' - chroot: centos-stream-x86_64 + chroot: fedora-rawhide-x86_64 register: result - name: assert that the copr project was disabled @@ -61,4 +61,4 @@ host: copr.fedorainfracloud.org state: absent name: '@copr/integration_tests' - chroot: centos-stream-x86_64 + chroot: fedora-rawhide-x86_64