From f8347383e2127e00dcff93c0306874340f2e9916 Mon Sep 17 00:00:00 2001 From: CentOS Sources Date: Tue, 8 Nov 2022 01:51:20 -0500 Subject: [PATCH] import ansible-collection-redhat-rhel_mgmt-1.1.0-2.el8 --- .ansible-collection-redhat-rhel_mgmt.metadata | 1 + .gitignore | 1 + SOURCES/redfish-metadata.patch | 20 ++++++ .../ansible-collection-redhat-rhel_mgmt.spec | 65 +++++++++++++++++-- 4 files changed, 80 insertions(+), 7 deletions(-) create mode 100644 SOURCES/redfish-metadata.patch diff --git a/.ansible-collection-redhat-rhel_mgmt.metadata b/.ansible-collection-redhat-rhel_mgmt.metadata index c01f3c7..ccdfbe8 100644 --- a/.ansible-collection-redhat-rhel_mgmt.metadata +++ b/.ansible-collection-redhat-rhel_mgmt.metadata @@ -1 +1,2 @@ +58f117fafe36a19425b3a9bc0ba69f33e5fa81ee SOURCES/community-general-5.4.0.tar.gz 15e459c7a1b3d4c727640a7cae47b8a8d41f7dcd SOURCES/fedora.linux_mgmt-1.0.0.tar.gz diff --git a/.gitignore b/.gitignore index e0c10ea..831593b 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,2 @@ +SOURCES/community-general-5.4.0.tar.gz SOURCES/fedora.linux_mgmt-1.0.0.tar.gz diff --git a/SOURCES/redfish-metadata.patch b/SOURCES/redfish-metadata.patch new file mode 100644 index 0000000..a71a68d --- /dev/null +++ b/SOURCES/redfish-metadata.patch @@ -0,0 +1,20 @@ +diff -up fedora.linux_mgmt-1.0.0/galaxy.yml~ fedora.linux_mgmt-1.0.0/galaxy.yml +--- fedora.linux_mgmt-1.0.0/galaxy.yml~ 2022-08-18 15:51:16.694699074 +0200 ++++ fedora.linux_mgmt-1.0.0/galaxy.yml 2022-08-18 15:54:51.257016538 +0200 +@@ -19,6 +19,7 @@ readme: README.md + authors: + - Pavel Cahyna + - Bulat Gaifullin (@bgaifullin) ++- Jose Delarosa (@jose-delarosa) + + ### OPTIONAL but strongly recommended + +@@ -32,7 +33,7 @@ license: + + # A list of tags you want to associate with the collection for indexing/searching. A tag name has the same character + # requirements as 'namespace' and 'name' +-tags: [ipmi, linux] ++tags: [ipmi, redfish, linux] + + # Collections that this collection requires to be installed for it to be usable. The key of the dict is the + # collection label 'namespace.name'. The value is a version range diff --git a/SPECS/ansible-collection-redhat-rhel_mgmt.spec b/SPECS/ansible-collection-redhat-rhel_mgmt.spec index 1ff32f0..fff7b2b 100644 --- a/SPECS/ansible-collection-redhat-rhel_mgmt.spec +++ b/SPECS/ansible-collection-redhat-rhel_mgmt.spec @@ -8,6 +8,7 @@ %global collection_namespace_orig fedora %global collection_name_orig linux_mgmt +%global collection_version_orig 1.0.0 %if 0%{?rhel} %global collection_namespace redhat @@ -20,13 +21,13 @@ Name: ansible-collection-%{collection_namespace}-%{collection_name} Url: https://github.com/pcahyna/fedora.linux_mgmt/ Summary: Ansible Collection of general system management and utility modules and other plugins -Version: 1.0.0 +Version: 1.1.0 Release: 2%{?dist} License: GPLv3+ %global collection_version %{version} -%global archivename %{collection_namespace_orig}.%{collection_name_orig}-%{version} +%global archivename %{collection_namespace_orig}.%{collection_name_orig}-%{collection_version_orig} %global extractdir %{archivename} # Helper macros originally from macros.ansible by Igor Raits @@ -60,7 +61,13 @@ Requires: ansible >= 2.9.10 %endif %endif -Source: https://github.com/pcahyna/fedora.linux_mgmt/archive/%{version}/%{archivename}.tar.gz +Source: https://github.com/pcahyna/fedora.linux_mgmt/archive/%{collection_version_orig}/%{archivename}.tar.gz + +# Collection tarballs from Galaxy +# Not used on Fedora. +Source901: https://galaxy.ansible.com/download/community-general-5.4.0.tar.gz + +Patch1: redfish-metadata.patch BuildArch: noarch @@ -90,7 +97,43 @@ Collection artifact for %{name}. This package contains %{collection_namespace}-% %endif %prep -%autosetup -n %{extractdir} +%if 0%{?rhel} +%setup -T -a 901 -c -n .external/community/general +%endif +%setup -n %{extractdir} + +%if 0%{?rhel} +%patch1 -p1 +%endif + +%if 0%{?rhel} +modules=( remote_management/redfish/redfish_{command,config,info}.py ) +module_utils=( redfish_utils.py ) + +mkdir -p plugins/modules +mkdir -p plugins/module_utils + +for dir in %{_builddir}/.external/*/*; do + name=$(basename "$dir") + ns=$(basename $(dirname "$dir")) + for module in "${modules[@]}"; do + dest_module=plugins/modules/$(basename $module) + cp -pL $dir/plugins/modules/$module $dest_module + # Replacing original collection name by downstream (vendored) name + if [ "${ns}" != "%{collection_namespace}" ] || [ "${name}" != "%{collection_name}" ] ; then + sed "s/${ns}[.]${name}/%{collection_namespace}.%{collection_name}/g" -i $dest_module + fi + done + for module_util in "${module_utils[@]}"; do + dest_module_util=plugins/module_utils/$module_util + cp -pL $dir/plugins/module_utils/$module_util $dest_module_util + # Replacing original collection name by downstream (vendored) name + if [ "${ns}" != "%{collection_namespace}" ] || [ "${name}" != "%{collection_name}" ] ; then + sed "s/${ns}[.]${name}/%{collection_namespace}.%{collection_name}/g" -i $dest_module_util + fi + done +done +%endif # Replacing original (Galaxy) collection name by downstream (Automation Hub) name %if "%{collection_namespace_orig}" != "%{collection_namespace}" || "%{collection_name_orig}" != "%{collection_name}" @@ -101,14 +144,19 @@ find -type f -exec \ # borrowed from from ansible-collection-ansible-netcommon find -type f ! -executable -type f -name '*.py' -print -exec sed -i -e '1{\@^#!.*@d}' '{}' + -%{SOURCE1} %{collection_namespace} %{collection_name} %{collection_version} > galaxy.yml.new -mv galaxy.yml.new galaxy.yml - %build +mkdir -p .collections/ansible_collections/%{collection_namespace}/%{collection_name}/ +cp -a * .collections/ansible_collections/%{collection_namespace}/%{collection_name}/ +%{SOURCE1} %{collection_namespace} %{collection_name} %{collection_version} > .collections/ansible_collections/%{collection_namespace}/%{collection_name}/galaxy.yml + +pushd .collections/ansible_collections/%{collection_namespace}/%{collection_name}/ %ansible_collection_build +popd %install +pushd .collections/ansible_collections/%{collection_namespace}/%{collection_name}/ %ansible_collection_install +popd %if %{with collection_artifact} # Copy collection artifact to /usr/share/ansible/collections/ for collection-artifact @@ -129,6 +177,9 @@ fi %endif %changelog +* Fri Aug 19 2022 Pavel Cahyna - 1.1.0-2 +- Add redfish_* modules from community.general + * Thu Aug 26 2021 Pavel Cahyna - 1.0.0-2 - Create collection artifact subpackage, disabled by default Taken from rhel-system-roles.