Bug 1869382 - Synchronizing Puppet Modules from a Git Repository using pulp-puppet-module-builder failed with Error: uninitialized constant Puppet::Util::Json::ParserError
Summary: Synchronizing Puppet Modules from a Git Repository using pulp-puppet-module-b...
Keywords:
Status: CLOSED DUPLICATE of bug 1886005
Alias: None
Product: Red Hat Satellite
Classification: Red Hat
Component: Pulp
Version: 6.7.0
Hardware: x86_64
OS: Linux
high
high
Target Milestone: Unspecified
Assignee: satellite6-bugs
QA Contact: Lai
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2020-08-17 18:50 UTC by asamad
Modified: 2023-09-15 00:46 UTC (History)
7 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2021-04-06 17:53:05 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)
patch puppet_module_builder.py (11.24 KB, text/plain)
2021-03-19 16:19 UTC, Mike McCune
no flags Details

Description asamad 2020-08-17 18:50:03 UTC
Description of problem:
Synchronizing Puppet Modules from a Git Repository using pulp-puppet-module-builder  failed with Error: uninitialized constant Puppet::Util::Json::ParserError

Version-Release number of selected component (if applicable):
satellite 6.7

How reproducible:
Every time.

Steps to Reproduce:
1. Create git repo
2. Attempt to use pulp-puppet-module-builder to build module in the repo using below command:

pulp-puppet-module-builder \
--output-dir=/opt/modules \
--url=ssh://git/ids/satellitepuppet.git \
--branch=master

https://access.redhat.com/documentation/en-us/red_hat_satellite/6.7/html-single/content_management_guide/index#Importing_Custom_Content-Synchronizing_Puppet_Modules_from_Git

Actual results:
pulp-puppet-module-builder from satellite failed with below error:

+ pulp-puppet-module-builder --output-dir=/opt/modules --url=ssh://git/ids/satellitepuppet.git --branch=master
cd /opt/modules
git clone --recursive ssh://git/ids/satellitepuppet.git
......
Are you sure you want to continue connecting (yes/no)? yes
find . -name Modulefile -o -name metadata.json
puppet module build ./modules/pci
mkdir -p /opt/modules
Skipping ids-pci-0.1.0.tar.gz as the file exists
puppet module build ./modules/additional_rpms
Warning: `puppet module build` is deprecated and will be removed in a future release. This action has been replaced by Puppet Development Kit. For more information visit https://puppet.com/docs/pdk/latest/pdk.html.
   (location: /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/face/module/build.rb:56:in `block (3 levels) in <top (required)>')
Error: uninitialized constant Puppet::Util::Json::ParserError
Did you mean?  Puppet::Util::Json::ParseError
               Puppet::ParseError
               ParseError
Error: Try 'puppet help module build' for usage


Expected results:
All puppet modules in the git repo should be built sucessfully using pulp-puppet-module-builder from satellite

Additional info:
Below workaround is being tested and working sucessfully.

In the file /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/module_tool/applications/application.rb, the line:
rescue Puppet::Util::Json::ParserError => ex

Must be changed to:
rescue Puppet::Util::Json::ParseError => ex

Fixing that allows the pulp-puppet-module-builder to complete sucessfully.

Comment 4 Melanie Falz 2021-03-01 07:49:44 UTC
Could you please let me know what info is needed to make some progress on this?
I am happy to support e.g. with data or details.

Comment 5 Mike McCune 2021-03-19 16:19:19 UTC
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 following workaround:

1) On the host you wish to run pulp-puppet-module-builder, install the Puppet Development Kit that will allow module building, via the 'pdk build' command

https://puppet.com/docs/pdk/2.x/pdk_install.html#install-pdk-on-linux

# sudo rpm -Uvh https://yum.puppet.com/puppet-tools-release-el-7.noarch.rpm
# satellite-maintain packages unlock
# yum install pdk

2) Apply patch supplied on this BZ to switch pulp-puppet-module- builder to use PDK's CLI to build modules

 * Download puppet_module_builder.py  from this BZ to your Satellite server

 * verify sha256sum
   # sha256sum puppet_module_builder.py 
   0cda14f5ce7d5e227a48ef13b2fb3684e49ae0413a580fd385e84f3d8fc388c4  puppet_module_builder.py

 * Copy patched file to target location:

 # cp puppet_module_builder.py /usr/lib/python2.7/site-packages/pulp_puppet/tools/puppet_module_builder.py

4) test the module builder:

pulp-puppet-module-builder \
--output-dir=/modules \
--url=git:mymodules.git \
--branch=develop

5) sync and operate as normal

Comment 6 Mike McCune 2021-03-19 16:19:47 UTC
Created attachment 1764724 [details]
patch puppet_module_builder.py

Comment 7 Mike McCune 2021-04-06 17:53:05 UTC
See more detailed discussion on this BZ for workarounds:

https://bugzilla.redhat.com/show_bug.cgi?id=1886005#c7

Going to close this bug out as a dupe of 1886005 and track discussion there

*** This bug has been marked as a duplicate of bug 1886005 ***

Comment 8 Red Hat Bugzilla 2023-09-15 00:46:28 UTC
The needinfo request[s] on this closed bug have been removed as they have been unresolved for 500 days


Note You need to log in before you can comment on or make changes to this bug.