Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

(PE-12299) Add Solaris 11 support #93

Merged

Conversation

MikaelSmith
Copy link
Contributor

This commit plumbs the puppet agent module to add Solaris 11 support.

This commit should be fairly consistent with how pe_repo handles
upgrading agents on Solaris 11 by updating the repo in
/etc/puppetlabs/installer/solaris.repo with the new puppet-agent
package and installing puppet-agent from there

Lots of things in this commit are less than ideal but the current state
of how Solaris 11 packaging handles files through
uninstallation/installation.

Since Solaris 11 will not uninstall packages if dependant packages are
also installed so the packages must be removed in a specific order or
else the puppet run will fail.

When uninstalling the pe-* packages, Solaris 11 decides to completely
remove everything in /etc/puppetlabs/ which is why this commit has to
go through and copy it to a temporary location during the upgrade.
However to install puppet-agent, the package needs to be in the repo
that lives in /etc/puppetlabs/installer/solaris.repo so the that repo
needs to be put back into place. After installing the puppet-agent
package it overwrites the existing configuration files with the default
configuration files. After installing the puppet-agent module the
/etc/puppetlabs directory is again copied into place so that the user
doesn't lose the ability to talk to the master server or any other
configurations that live in /etc/puppetlabs.

When upgrading Solaris 11 agents, the services are in a maintenance
state where Puppet is unable to start them. Use a script that waits for
the currently running agent run to stop and then calls puppet to ensure
that puppet and mcollective are running so that users do not have to
login to the nodes to perform these steps by hand.

This behavior is currently what windows is doing to start puppet and
mcollective agents when upgrading with the puppet_agent module.

@MikaelSmith
Copy link
Contributor Author

This looks pretty good, planning to do some testing tomorrow.

@@ -0,0 +1,14 @@
#!/bin/bash

puppet_pid="<%= @puppet_agent_pid %>"
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

An improvement was made to the Windows script to pass in the PID (so the template isn't regenerated on each run). I'll do that here. Is it better to still inline the content (small file) or use a source?

@MikaelSmith
Copy link
Contributor Author

Updated passing PID, but it appears to have some ordering issues in prepare. Working on fixing them.

@MikaelSmith MikaelSmith force-pushed the feature/master/pe-12299-add-solaris-11 branch from d980a42 to 262bb94 Compare March 18, 2016 22:51
@MikaelSmith
Copy link
Contributor Author

Tested and it looks good, this should be ready to go. @demophoon @highb

@MikaelSmith MikaelSmith force-pushed the feature/master/pe-12299-add-solaris-11 branch 2 times, most recently from b89bb10 to 03817b1 Compare March 24, 2016 22:56
@MikaelSmith
Copy link
Contributor Author

Trying again. This needs to be re-tested on Solaris 11.

@MikaelSmith
Copy link
Contributor Author

Solaris 11 upgrades from 3.8 still appear to work.

@highb
Copy link
Contributor

highb commented Mar 25, 2016

Arg, this needs one more rebase. >_>

Michael Smith and others added 3 commits March 25, 2016 17:17
This commit plumbs the puppet agent module to add Solaris 11 support.

This commit should be fairly consistent with how pe_repo handles
upgrading agents on Solaris 11 by updating the repo in
`/etc/puppetlabs/installer/solaris.repo` with the new puppet-agent
package and installing puppet-agent from there

Lots of things in this commit are less than ideal but the current state
of how Solaris 11 packaging handles files through
uninstallation/installation.

Since Solaris 11 will not uninstall packages if dependant packages are
also installed so the packages must be removed in a specific order or
else the puppet run will fail.

When uninstalling the pe-* packages, Solaris 11 decides to completely
remove everything in `/etc/puppetlabs/` which is why this commit has to
go through and copy it to a temporary location during the upgrade.
However to install puppet-agent, the package needs to be in the repo
that lives in `/etc/puppetlabs/installer/solaris.repo` so the that repo
needs to be put back into place. After installing the puppet-agent
package it overwrites the existing configuration files with the default
configuration files. After installing the puppet-agent module the
/etc/puppetlabs directory is again copied into place so that the user
doesn't lose the ability to talk to the master server or any other
configurations that live in /etc/puppetlabs.

When upgrading Solaris 11 agents, the services are in a maintenance
state where Puppet is unable to start them. Use a script that waits for
the currently running agent run to stop and then calls puppet to ensure
that puppet and mcollective are running so that users do not have to
login to the nodes to perform these steps by hand.

This behavior is currently what windows is doing to start puppet and
mcollective agents when upgrading with the puppet_agent module.
Similar to the improvement made for the Windows install script, pass the
Puppet agent PID as an argument to the solaris service script. This
prevents recreating the file every Puppet run.
@MikaelSmith MikaelSmith force-pushed the feature/master/pe-12299-add-solaris-11 branch from 03817b1 to ea05394 Compare March 26, 2016 00:17
@MikaelSmith
Copy link
Contributor Author

Rebased.

@highb
Copy link
Contributor

highb commented Mar 28, 2016

Tested 3.8 -> 2016.1 PE upgrades with this change on a Sol11 box, it passed. Now running 2015.3.3 -> 2016.1.

@highb
Copy link
Contributor

highb commented Mar 28, 2016

Hm, seems that we still aren't installing the transition module:

Error: Could not retrieve catalog from remote server: Error 400 on SERVER: Evaluation Error: Error while evaluating a Resource Statement, Evaluation Error: Error while evaluating a Resource Statement, Invalid resource type transition at /etc/puppetlabs/code/environments/production/modules/puppet_agent/manifests/install/remove_packages.pp:152:9 on node s2f7gzq2qhruma5.delivery.puppetlabs.net

@MikaelSmith
Copy link
Contributor Author

But only on 215.3.3 -> 2016.1 upgrades?

@highb
Copy link
Contributor

highb commented Mar 28, 2016

Seems so. I'm re-examining what we're doing in https://github.com/puppetlabs/pe_acceptance_tests/blob/2016.2.x/setup/agent_upgrade.rb to try to figure out what might be happening.

@highb
Copy link
Contributor

highb commented Mar 28, 2016

Oh, r10k doesn't manage module dependencies. https://github.com/puppetlabs/pe_acceptance_tests-control/blob/production/Puppetfile needs to be updated. Going to put up a PR.

@highb
Copy link
Contributor

highb commented Mar 28, 2016

Hm, looks like something is going wrong with the Transition resource during 2015.3.3 to 2016.1.x upgrade:

      Notice: /Stage[main]/Puppet_agent::Osfamily::Solaris/Exec[puppet_agent copy packages]/returns: executed successfully
      Notice: /Stage[main]/Puppet_agent::Osfamily::Solaris/File[/tmp/puppet_agent/]/ensure: created
      Notice: /Stage[main]/Puppet_agent::Osfamily::Solaris/Exec[puppet_agent backup /etc/puppetlabs/]/returns: executed successfully
      Notice: /Package[puppet-agent]/ensure: removed
      Info: Creating state file /opt/puppetlabs/puppet/cache/state/state.yaml
      Error: No such file or directory @ dir_s_rmdir - /opt/puppetlabs/puppet/cache/state/state.yaml20160328-2456-gj7vgv.lock
      Notice: /Stage[main]/Puppet_agent::Install::Remove_packages/Notify[using puppetlabs-transition to remove puppet-agent: Solaris does not support versionable]: Dependency Transition[remove puppet-agent] has failures: true
      Notice: /Stage[main]/Puppet_agent::Install/Exec[puppet_agent restore /etc/puppetlabs]: Dependency Transition[remove puppet-agent] has failures: true
      Error: /Stage[main]/Puppet_agent::Install::Remove_packages/Transition[remove puppet-agent]/enable: change from enabled to transition Package[puppet-agent] to state {"ensure"=>"absent", "adminfile"=>"/opt/puppetlabs/packages/solaris-noask"} failed: No such file or directory @ dir_s_rmdir - /opt/puppetlabs/puppet/cache/state/state.yaml20160328-2456-gj7vgv.lock
      Warning: /Stage[main]/Puppet_agent::Install::Remove_packages/Notify[using puppetlabs-transition to remove puppet-agent: Solaris does not support versionable]: Skipping because of failed dependencies
      Warning: /Stage[main]/Puppet_agent::Install/Exec[puppet_agent restore /etc/puppetlabs]: Skipping because of failed dependencies
      Notice: /Stage[main]/Puppet_agent::Install/Package[puppet-agent]: Dependency Transition[remove puppet-agent] has failures: true
      Warning: /Stage[main]/Puppet_agent::Install/Package[puppet-agent]: Skipping because of failed dependencies
      Notice: /Stage[main]/Puppet_agent::Install/Exec[puppet_agent post-install restore /etc/puppetlabs]: Dependency Transition[remove puppet-agent] has failures: true
      Warning: /Stage[main]/Puppet_agent::Install/Exec[puppet_agent post-install restore /etc/puppetlabs]: Skipping because of failed dependencies
      Info: Class[Puppet_agent]: Unscheduling all events on Class[Puppet_agent]

Full log of the upgrade run: https://gist.github.com/highb/b0b5351ac43d9eddd08d

@MikaelSmith
Copy link
Contributor Author

Only on Solaris 11?

@highb
Copy link
Contributor

highb commented Mar 29, 2016

@MikaelSmith I'm checking out Sol10 now.

@highb
Copy link
Contributor

highb commented Mar 29, 2016

Yeah, it appears to only be a problem on Solaris 11 on a 2015.2.3->2015.3.3 upgrade: https://gist.github.com/highb/a4f0179af9149ed5a34ba6dfdda157cb

@MikaelSmith
Copy link
Contributor Author

I think I've fixed it, running through some tests to be sure.

Update: specs are obviously broken, and I want to cleanup the behavior so it doesn't rebuild the repository every run.

Moves determining puppet_version to params, so private sub-classes can
use puppet_agent::puppet_version to get the target version.
@MikaelSmith MikaelSmith force-pushed the feature/master/pe-12299-add-solaris-11 branch 2 times, most recently from bc909e7 to 6fed94e Compare March 31, 2016 15:53
Fixes upgrading from a puppet-agent package to a new version on Solaris
11. This simplifies the upgrade process by using the existing publisher
with a new version of the package and doing `pkg update`.
@MikaelSmith MikaelSmith force-pushed the feature/master/pe-12299-add-solaris-11 branch 3 times, most recently from 20aaa91 to 8a3c997 Compare March 31, 2016 17:45
Only rebuild the Solaris 11 repo when it doesn't contain the needed
package.
@MikaelSmith MikaelSmith force-pushed the feature/master/pe-12299-add-solaris-11 branch from 8a3c997 to 78ce9af Compare March 31, 2016 18:15
@MikaelSmith
Copy link
Contributor Author

@highb passed acceptance runs testing PE 3.8 -> 2015.3.3 and 2015.2.3 -> 2015.3.3. I think this is ready.

# Strip letters from development builds.
$_version_without_letters = regsubst($package_version, /[a-zA-Z]/, '', 'G')
$_solaris_version = regsubst($_version_without_letters, /(^-|-$)/, '', 'G')
$_package_file_name = "${puppet_agent::package_name}@${_solaris_version},5.11-1.i386.p5p"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Couldn't the i386 vs sparc part be set in a variable? Then we wouldn't need to duplicate all the regex for both platforms.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, probably.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does it also make sense for Solaris 10 packages?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well, the arch is the same between 10 and 11, right? There could be a $_arch that is set to either sparc or i386 depending on the sun4[uv] regex, and then we just use $_arch regardless of wether it is on 10 or 11.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ping @demophoon where did needing to strip letters out of development builds come from? If I look at current Solaris 11 package names, I see things like puppet-agent@1.4.1.36.778531,5.11-1.i386.p5p.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@MikaelSmith That is how our packaging works with solaris package names. That was taken directly out of Vanagon here: https://github.com/puppetlabs/vanagon/blob/5236eefe97963f3cfc312bbef1e3e1b388d6ffc4/lib/vanagon/platform/solaris_11.rb#L100-L107

Solaris 11 seems to be the only platform that has this version naming oddity.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, I see. Ok, I'll put it back to Solaris 11 only.

Combines common logic for determining package file names on Solaris 10
and 11.
@MikaelSmith MikaelSmith force-pushed the feature/master/pe-12299-add-solaris-11 branch from 15e13b9 to 46f2ee5 Compare April 1, 2016 22:26
@MikaelSmith
Copy link
Contributor Author

Updated.

@MikaelSmith
Copy link
Contributor Author

Ping @highb

$_version_without_letters = regsubst($package_version, /[a-zA-Z]/, '', 'G')
$_solaris_version = regsubst($_version_without_letters, /(^-|-$)/, '', 'G')

$_package_file_name = "${puppet_agent::package_name}@${_solaris_version},5.11-1.${pkg_arch}.p5p"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep, this is what I had in mind! Glad it worked!

@highb highb merged commit e7415ac into puppetlabs:master Apr 4, 2016
@MikaelSmith MikaelSmith deleted the feature/master/pe-12299-add-solaris-11 branch April 5, 2016 21:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants