Bug 1886005
Summary: | pulp-puppet-module-builder uses depreciated pulp command and is unable to build any puppet module | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Product: | Red Hat Satellite | Reporter: | Mirek Długosz <mzalewsk> | ||||||||
Component: | Pulp | Assignee: | satellite6-bugs <satellite6-bugs> | ||||||||
Status: | CLOSED ERRATA | QA Contact: | Lai <ltran> | ||||||||
Severity: | high | Docs Contact: | |||||||||
Priority: | high | ||||||||||
Version: | 6.8.0 | CC: | asamad, janarula, jason.holland, jkrajice, kurathod, matthew.lesieur, mfalz, mmccune, ramsingh, rcarrier, riehecky, satellite6-bugs, sfroemer, snemeth, zhunting | ||||||||
Target Milestone: | 6.9.2 | Keywords: | Triaged | ||||||||
Target Release: | Unused | ||||||||||
Hardware: | Unspecified | ||||||||||
OS: | Unspecified | ||||||||||
Whiteboard: | |||||||||||
Fixed In Version: | pulp-puppet-2.21.5.1-1 | Doc Type: | If docs needed, set a value | ||||||||
Doc Text: | Story Points: | --- | |||||||||
Clone Of: | Environment: | ||||||||||
Last Closed: | 2021-05-20 18:05:30 UTC | Type: | Bug | ||||||||
Regression: | --- | Mount Type: | --- | ||||||||
Documentation: | --- | CRM: | |||||||||
Verified Versions: | Category: | --- | |||||||||
oVirt Team: | --- | RHEL 7.3 requirements from Atomic Host: | |||||||||
Cloudforms Team: | --- | Target Upstream Version: | |||||||||
Embargoed: | |||||||||||
Attachments: |
|
Description
Mirek Długosz
2020-10-07 12:49:45 UTC
workaround: download puppet development kit #wget --content-disposition 'https://pm.puppet.com/cgi-bin/pdk_download.cgi?dist=el&rel=6&arch=x86_64&ver=latest' install pdk-1.18.1.0-1.el7.x86_64.rpm change the file /usr/lib/python2.7/site-packages/pulp_puppet/tools/puppet_module_builder.py: shell line 275 in file /usr/lib/python2.7/site-packages/pulp_puppet/tools/puppet_module_builder.py to for path in find_modules(): shell('pdk build --force %s' % path) pkg_dir = os.path.join(path, PKG_DIR) publish_module(pkg_dir, options.output_dir, options.force) it turns out the workaround fixes the problem in general, but in case you start pdk build in uplevel directory the error is seen again: [root@labsystem-sat65 test]# pdk build --force ./check │ pdk (INFO): `pdk build` can only be run from inside a valid module with a metadata.json. [root@labsystem-sat65 check]# pdk build --force . pdk (INFO): Building check-test version 0.0.1 pdk (INFO): Build of check-test has completed successfully. Built package can be found here: /root/test/check/pkg/check-test-0.0.1.tar.gz with add chdir(path) in /usr/lib/python2.7/site-packages/pulp_puppet/tools/puppet_module_builder.py (again) Build puppet modules found during the search and publish (copy) them to the user specified output directory. :param options: The command line options. :type options: optparse.Options """ for path in find_modules(): chdir(path) shell('pdk build --force .') chdir("..") pkg_dir = os.path.join(path, PKG_DIR) publish_module(pkg_dir, options.output_dir, options.force) this problem is solved. With following change, even the generic use-case is possible. def build_puppet_modules(options): """ Build puppet modules found during the search and publish (copy) them to the user specified output directory. :param options: The command line options. :type options: optparse.Options """ for path in find_modules(): basedir = os.getcwd() chdir(path) shell('pdk build --force .') chdir(basedir) pkg_dir = os.path.join(basedir, path, PKG_DIR) publish_module(pkg_dir, options.output_dir, options.force) The test-cases are splitted into devel and master-branch master = special use-case by customer devel = generic use-case [root@host repo]# git branch * master [root@host repo]# tree . . └── subdir ├── manifests │ ├── appserver.pp │ ├── base.pp │ ├── init.pp │ ├── params.pp │ └── servers.pp ├── metadata.json <<<=== metadata.json at subdirectoy └── README.md 2 directories, 7 files [root@host repo]# git checkout devel Branch devel set up to track remote branch devel from origin. Switched to a new branch 'devel' [root@host repo]# tree . . ├── subdir │ ├── manifests │ │ ├── appserver.pp │ │ ├── base.pp │ │ ├── init.pp │ │ ├── params.pp │ │ └── servers.pp │ └── README.md └── metadata.json <<<====== metadata.json at toplevel 2 directories, 7 files /// Running the tests /// [root@host ~]# /usr/bin/pulp-puppet-module-builder --output-dir=/modules --url=git.com:project/repo.git --branch=devel cd /root git clone --recursive git.com:project/repo.git cd repo git status git remote show -n origin git fetch git fetch --tags git checkout devel git pull find . -name Modulefile -o -name metadata.json cd . pdk build --force . cd /root/repo mkdir -p /modules cp /root/repo/./pkg/subdir-test-0.0.1.tar.gz /modules cd /modules cd /root/repo cd /root [root@host ~]# /usr/bin/pulp-puppet-module-builder --output-dir=/modules --url=git.com:project/repo.git --branch=master cd /root git clone --recursive git.com:project/repo.git cd repo git status git remote show -n origin git fetch git fetch --tags git checkout master git pull find . -name Modulefile -o -name metadata.json cd ./subdir pdk build --force . cd /root/repo mkdir -p /modules cp /root/repo/./subdir/pkg/subdir-test-0.0.1.tar.gz /modules cd /modules cd /root/repo cd /root Created attachment 1738465 [details] patch for comment#7 *** Bug 1869382 has been marked as a duplicate of this bug. *** As noted in this BZ, the puppet version we ship in Satellite 6.8 and later does not support the 'puppet module build' command as well as this functionality being deprecated and removed in Satellite 7 coming up mid-2022. If customers still rely on this functionaliy they can perform the workarounds outlined in this BZ and remain supported but we have no plans to resolve this in the Satellite 6 product line directly. Created attachment 1770453 [details]
pulp-puppet-tools-2.21.3-3.HFRHBZ1886005.el7sat.noarch.rpm
The hotfix pulp-puppet-tools-2.21.3-3.HFRHBZ1886005.el7sat.noarch.rpm appears to be incomplete. There is a line missing that changes back to the basedir. Without that line, this fails to traverse the modules directory correctly. Can you update the hotfix please? --- puppet_module_builder.py.orig 2021-04-15 12:21:29.255299251 -0500 +++ puppet_module_builder.py 2021-04-15 12:21:37.116416970 -0500 @@ -277,6 +277,7 @@ basedir = os.getcwd() chdir(path) shell('pdk build --force .') + chdir(basedir) pkg_dir = os.path.join(basedir, path, PKG_DIR) publish_module(pkg_dir, options.output_dir, options.force) Thanks *** Satellite 6.8.6 Hotfix Available *** 1) Download pulp-puppet-tools-2.21.3-4.HFRHBZ1886005.el7sat.noarch.rpm from this bugzilla to your Satellite 2) Download Puppetlabs tools package and install on your Satellite: satellite-maintain packages unlock sudo rpm -Uvh https://yum.puppet.com/puppet-tools-release-el-7.noarch.rpm yum -y install pdk satellite-maintain packages lock 3) Install hotfix: rpm -Uvh pulp-puppet-tools-2.21.3-4.HFRHBZ1886005.el7sat.noarch.rpm 4) resume operations Created attachment 1777835 [details]
pulp-puppet-tools-2.21.3-4.HFRHBZ1886005.el7sat.noarch.rpm
Jason, apologies for the missed line, see the updated RPM attached. Thank you very much Mike, the updated RPM appears to fix that issue. Tested and everything works as expected. Steps to test. 1. Apply patch from command 19, but on step 2 use `foremain-maintain packages install pdk`. 2. Run pulp-puppet-module-builder 3. Check output for usage of pdk from 2. 4. (optional), follow commands from 2 and run `pdk build --force .` and check result. Expected: 3) Should see that `pdk build --force .` is used in output. 4) Should see that the packages are built. Actual: 3) # pulp-puppet-module-builder cd /root git status find . -name Modulefile -o -name metadata.json cd ./puppet-access_insights_client pdk build --force . cd /root mkdir -p /root Skipping lphiri-access_insights_client-1.0.1.tar.gz as the file exists cd /root cd /root cd /root 4) # pdk build --force . pdk (INFO): Building lphiri-access_insights_client version 1.0.1 pdk (INFO): Build of lphiri-access_insights_client has completed successfully. Built package can be found here: /root/puppet-access_insights_client/pkg/lphiri-access_insights_client-1.0.1.tar.gz Verified on 6.9.2 snap 2 python-pulp-puppet-common-2.21.5.1-1.el7sat.noarch pulp-puppet-plugins-2.21.5.1-1.el7sat.noarc Since the problem described in this bug report should be resolved in a recent advisory, it has been closed with a resolution of ERRATA. For information on the advisory (Satellite 6.9.2 Async Bug Fix Update), and where to find the updated files, follow the link below. If the solution does not work for you, open a new bug report. https://access.redhat.com/errata/RHBA-2021:2074 The needinfo request[s] on this closed bug have been removed as they have been unresolved for 365 days |