Bug #21248
closed--upgrade-puppet doesn't migrate environments in the correct location
Description
Cloned from https://bugzilla.redhat.com/show_bug.cgi?id=1498749
Description of problem:
--upgrade-puppet doesn't migrate environments in the correct location.
Environments are migrated from p3 /etc/puppet/environments to wrong "/etc/puppetlabs/code/environments/environments" and thus are not recognized by agents at hosts.
Environments should be moved into p4 "/etc/puppetlabs/code/environments":
- find /etc -name KT_Default_Organization_*
/etc/puppetlabs/code/environments/environments/KT_Default_Organization_Library_RHEL7_2 < p4 but wrong location !!!
/etc/puppet/environments/KT_Default_Organization_Library_RHEL7_2 < p3 original
- find /etc -name KT_Default_Organization_*
/etc/puppetlabs/code/environments/KT_Default_Organization_Library_RHEL7_2
Version-Release number of selected component (if applicable):
satellite-6.3.0-19.0.beta.el7sat.noarch
satellite-installer-6.3.0.4-1.beta.el7sat.noarch
katello-installer-base-3.4.5.2-1.el7sat.noarch
How reproducible:
Steps to Reproduce:
1. Have an puppet environment with a module applied on a host:
- hammer environment info --name KT_Default_Organization_Library_RHEL7_2
Id: 2
Name: KT_Default_Organization_Library_RHEL7_2
Puppetclasses:
access_insights_client
foreman_scap_client
foreman_scap_client::params
mc <<< applied module
stdlib
stdlib::stages
Locations:
Default Location
Organizations:
Default Organization
Created at: 2017/10/04 15:46:13
Updated at: 2017/10/04 15:46:13
2. Upgrade puppet:
- satellite-installer --upgrade-puppet
...
Upgrade Step: copy_data...
cp -rfp /etc/puppet/environments /etc/puppetlabs/code/environments finished successfully!
cp -rfp /var/lib/puppet/ssl /etc/puppetlabs/puppet finished successfully!
cp -rfp /var/lib/puppet/foreman_cache_data /opt/puppetlabs/puppet/cache/ finished successfully!
...
3. Check up the environment after puppet upgrade:
@HOST:- service puppet restart
- journalctl -efu puppet
...
Oct 04 20:57:08 <HOST_FQDN> systemd1: Started Puppet agent.
Oct 04 20:57:08 <HOST_FQDN> systemd1: Starting Puppet agent...
Oct 04 20:57:14 <HOST_FQDN> puppet-agent985: Starting Puppet client version 3.8.6
Oct 04 20:57:14 <HOST_FQDN> puppet-agent1298: Unable to fetch my node definition, but the agent run will continue:
Oct 04 20:57:14 <HOST_FQDN> puppet-agent1298: Find /KT_Default_Organization_Library_RHEL7_2/node/<HOST_FQDN>?transaction... resulted in 404 with the message: {"message":"Not Found: Could not find environment 'KT_Default_Organization_Library_RHEL7_2'","issue_kind":"RUNTIME_ERROR"}
Oct 04 20:57:14 <HOST_FQDN> puppet-agent1298: (/File[/var/lib/puppet/facts.d]) Could not evaluate: Could not retrieve information from environment KT_Default_Organization_Library_RHEL7_2 source(s) puppet://<SAT_FQDN>/pluginfacts
Oct 04 20:57:14 <HOST_FQDN> puppet-agent1298: (/File[/var/lib/puppet/lib]) Could not evaluate: Could not retrieve information from environment KT_Default_Organization_Library_RHEL7_2 source(s) puppet://<SAT_FQDN>/plugins
Oct 04 20:57:17 <HOST_FQDN> puppet-agent1298: Could not retrieve catalog from remote server: Find /KT_Default_Organization_Library_RHEL7_2/catalog/<HOST_FQDN>?facts_fo... resulted in 404 with the message: {"message":"Not Found: Could not find environment 'KT_Default_Organization_Library_RHEL7_2'","issue_kind":"RUNTIME_ERROR"}
Oct 04 20:57:17 <HOST_FQDN> puppet-agent1298: Using cached catalog
Oct 04 20:57:17 <HOST_FQDN> puppet-agent1298: Could not retrieve catalog; skipping run
Oct 04 20:57:17 <HOST_FQDN> puppet985: /usr/share/ruby/vendor_ruby/puppet/agent.rb:87:in `exit': no implicit conversion from nil to integer (TypeError)
Actual results:
environments in wrong location thus not recognized by agents
Expected results:
environments moved into correct location and recognized by agents
- mv /etc/puppetlabs/code/environments/{environments/KT_*,}