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

(PA-2385) Update service management to run always for windows #391

Merged
merged 2 commits into from
Feb 26, 2019

Conversation

mcdonaldseanp
Copy link
Contributor

No description provided.

Previosly, we only managed services on failure in the powershell script for
agent upgrades. Service management for successes were done through the MSI and
then through a subsequent puppet run (for pxp-agent service management).

This commit updates the script to also manage services in the upgrade script
(i.e. actually manage service startup for pxp-agent/puppet in the script
rather than relying on puppet to be available).

This should alleviate concerns around the initial puppet run failing (and thus
leaving pxp-agent off) after upgrades
@mcdonaldseanp mcdonaldseanp force-pushed the PA2385 branch 8 times, most recently from 02fadfb to 9ee5403 Compare February 26, 2019 21:57
This commit updates the install_puppet.ps1 script to a file resource rather
than a template.
[String] $PuppetMaster='<%= @_puppet_master %>',
[String] $PuppetStartType='<%= @_agent_startup_mode %>',
[String] $InstallArgs='<%= @_install_options %>',
[String] $InstallScriptPIDFile='<%= @_install_pid_file_loc %>',
Copy link
Contributor

Choose a reason for hiding this comment

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

This isn't in the PS based set of args? Is that on purpose? From reading below, it looks like you removed the need for it, but wanted to double check.

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, there's no need for this param anymore

# When the MSI installargs parameter is passed to the powershell script it's inside
# a cmd.exe instance, so we need to escape the quotes correctly so they show up as
# plaintext double quotes to the powershell command. (To correctly escape to a
# plaintext " you use three "'s in cmd.exe)
Copy link
Contributor

Choose a reason for hiding this comment

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

I hate cross boundary quoting. A lot.

# The powershell execution uses -Command and not -File because -File will interpolate the quotes
# in a context like cmd.exe: https://docs.microsoft.com/en-us/powershell/scripting/components/console/powershell.exe-command-line-help?view=powershell-6#-file--
# Because of this it's much cleaner to use -Command and use single quotes for each powershell param
command => "${::system32}\\cmd.exe /S /c start /b ${::system32}\\WindowsPowerShell\\v1.0\\powershell.exe \
Copy link
Contributor

Choose a reason for hiding this comment

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

Our community will truly appreciate your commentary.

@caseywilliams caseywilliams merged commit 00b3b78 into puppetlabs:master Feb 26, 2019
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