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

(MODULES-5622) Add REINSTALLMODE for win install #253

Merged
merged 1 commit into from
Nov 15, 2017
Merged

(MODULES-5622) Add REINSTALLMODE for win install #253

merged 1 commit into from
Nov 15, 2017

Conversation

jcoconnor
Copy link
Contributor

Set REINSTALLMODE for Puppet Agent Upgrade/Downgrade defaulting to
"amus" which forces all files to be replaced regardless of version or
checksum.

@jcoconnor
Copy link
Contributor Author

@glennsarti & @Iristyle Is this what is needed here and how do I go about testing it?

@puppetcla
Copy link

CLA signed by all contributors.

@jcoconnor
Copy link
Contributor Author

@glennsarti I've updated this with your suggestion to use install_options

@glennsarti
Copy link
Contributor

@jcoconnor Can you rebase onto master.

@jcoconnor
Copy link
Contributor Author

@glennsarti Done

@jcoconnor
Copy link
Contributor Author

Successul Unit Test Run on the windows install functions:

johnoconnor@Johns-MacBook-Pro-4:~/gitrepos/puppetlabs-puppet_agent [MODULES-5622-PA-REINSTALLMODE] 18:13:37 $ bundle exec rspec spec/classes/puppet_agent_windows_install_spec.rb

puppet_agent
  Windows Kernelmajversion 5.1
    without aio_agent_version (FOSS)
      should contain Class[puppet_agent::windows::install]
    is_pe
      with up to date aio_agent_version matching server
        should not contain File[c:\tmp\install_puppet.bat]
        should not contain Exec[fix inheritable SYSTEM perms]
      with equal package_version containing git sha
        should not contain File[c:\tmp\install_puppet.bat]
        should not contain Exec[install_puppet.bat]
      with out of date aio_agent_version
        should contain Class[puppet_agent::windows::install]
        should contain File[C:\tmp\install_puppet.bat] with content =~ /msiexec\.exe\ \/qn\ \/norestart\ \/i\ "C:\\Document\ and\ Settings\\All\ Users\\Application\ Data\\Puppetlabs\\packages\\puppet\-agent\-x86\.msi"/
        should contain Exec[fix inheritable SYSTEM perms]
    install_options =>
      OPTION1=value1 OPTION2=value2
        should contain File[C:\tmp\install_puppet.bat] with content =~ /msiexec.exe .+ OPTION1=value1 OPTION2=value2/
        should not contain File[C:\tmp\install_puppet.bat] with content =~ /msiexec.exe .+ REINSTALLMODE="amus"/
    Default INSTALLMODE Option
      REINSTALLMODE=amus
        should contain File[C:\tmp\install_puppet.bat] with content =~ /msiexec.exe .+ REINSTALLMODE="amus"/
    source =>
      https://alterernate.com/puppet-agent.msi
        should contain File[C:\tmp\install_puppet.bat] with content =~ /\/l\*vx "C:\\tmp\\puppet-\d+_\d+_\d+-\d+_\d+-installer.log"/
        should contain Exec[fix inheritable SYSTEM perms]
      C:/tmp/puppet-agent-x64.msi
        should contain File[C:\tmp\install_puppet.bat] with content =~ /\/l\*vx "C:\\tmp\\puppet-\d+_\d+_\d+-\d+_\d+-installer.log"/
        should contain Exec[fix inheritable SYSTEM perms]
      C:\Temp/ Folder\puppet-agent-x64.msi
        should contain File[C:\tmp\install_puppet.bat] with content =~ /\/l\*vx "C:\\tmp\\puppet-\d+_\d+_\d+-\d+_\d+-installer.log"/
        should contain Exec[fix inheritable SYSTEM perms]
      C:/Temp/ Folder/puppet-agent-x64.msi
        should contain File[C:\tmp\install_puppet.bat] with content =~ /\/l\*vx "C:\\tmp\\puppet-\d+_\d+_\d+-\d+_\d+-installer.log"/
        should contain Exec[fix inheritable SYSTEM perms]
      \\garded\c$\puppet-agent-x64.msi
        should contain File[C:\tmp\install_puppet.bat] with content =~ /\/l\*vx "C:\\tmp\\puppet-\d+_\d+_\d+-\d+_\d+-installer.log"/
        should contain Exec[fix inheritable SYSTEM perms]
      default source
        should contain File[C:\tmp\install_puppet.bat] with content =~ /\/l\*vx "C:\\tmp\\puppet-\d+_\d+_\d+-\d+_\d+-installer\.log"/
        should contain Exec[install_puppet.bat]
        should not contain File[C:\tmp\puppet-agent.msi]
        should contain Exec[fix inheritable SYSTEM perms]
      puppet:///puppet_agent/puppet-agent-1.1.0-x86.msi
        should contain File[C:\tmp\install_puppet.bat] with content =~ /msiexec.exe \/qn \/norestart \/i "C:\\tmp\\puppet-agent.msi"/
        should contain Exec[fix inheritable SYSTEM perms]
    arch =>
      specify x86
        should contain File[C:\tmp\install_puppet.bat] with content =~ /msiexec.exe \/qn \/norestart \/i "https:\/\/downloads.puppetlabs.com\/windows\/puppet-agent-1.2.1.1-x86.msi"/
      try x64 on x86 system
        should raise Puppet::Error with message matching /Unable to install x64 on a x86 system/
    msi_move_locked_files =>
      default
        should contain File[C:\tmp\install_puppet.bat] with content !~ /Move puppetres\.dll/
      specify false
        should contain File[C:\tmp\install_puppet.bat] with content !~ /Move puppetres\.dll/
      specify true
        should contain File[C:\tmp\install_puppet.bat] with content =~ /Move puppetres\.dll/
  rubyplatform
    i386-ming32
      should contain Exec[install_puppet.bat]
      should contain Exec[fix inheritable SYSTEM perms]
    x86
      should contain Exec[install_puppet.bat]
      should contain Exec[fix inheritable SYSTEM perms]
  Windows Kernelmajversion 6.1
    without aio_agent_version (FOSS)
      should contain Class[puppet_agent::windows::install]
    is_pe
      with up to date aio_agent_version matching server
        should not contain File[c:\tmp\install_puppet.bat]
        should not contain Exec[fix inheritable SYSTEM perms]
      with equal package_version containing git sha
        should not contain File[c:\tmp\install_puppet.bat]
        should not contain Exec[install_puppet.bat]
      with out of date aio_agent_version
        should contain Class[puppet_agent::windows::install]
        should contain File[C:\tmp\install_puppet.bat] with content =~ /msiexec\.exe\ \/qn\ \/norestart\ \/i\ "C:\\ProgramData\\Puppetlabs\\packages\\puppet\-agent\-x64\.msi"/
        should contain Exec[fix inheritable SYSTEM perms]
    install_options =>
      OPTION1=value1 OPTION2=value2
        should contain File[C:\tmp\install_puppet.bat] with content =~ /msiexec.exe .+ OPTION1=value1 OPTION2=value2/
        should not contain File[C:\tmp\install_puppet.bat] with content =~ /msiexec.exe .+ REINSTALLMODE="amus"/
    Default INSTALLMODE Option
      REINSTALLMODE=amus
        should contain File[C:\tmp\install_puppet.bat] with content =~ /msiexec.exe .+ REINSTALLMODE="amus"/
    source =>
      https://alterernate.com/puppet-agent.msi
        should contain File[C:\tmp\install_puppet.bat] with content =~ /\/l\*vx "C:\\tmp\\puppet-\d+_\d+_\d+-\d+_\d+-installer.log"/
        should contain Exec[fix inheritable SYSTEM perms]
      C:/tmp/puppet-agent-x64.msi
        should contain File[C:\tmp\install_puppet.bat] with content =~ /\/l\*vx "C:\\tmp\\puppet-\d+_\d+_\d+-\d+_\d+-installer.log"/
        should contain Exec[fix inheritable SYSTEM perms]
      C:\Temp/ Folder\puppet-agent-x64.msi
        should contain File[C:\tmp\install_puppet.bat] with content =~ /\/l\*vx "C:\\tmp\\puppet-\d+_\d+_\d+-\d+_\d+-installer.log"/
        should contain Exec[fix inheritable SYSTEM perms]
      C:/Temp/ Folder/puppet-agent-x64.msi
        should contain File[C:\tmp\install_puppet.bat] with content =~ /\/l\*vx "C:\\tmp\\puppet-\d+_\d+_\d+-\d+_\d+-installer.log"/
        should contain Exec[fix inheritable SYSTEM perms]
      \\garded\c$\puppet-agent-x64.msi
        should contain File[C:\tmp\install_puppet.bat] with content =~ /\/l\*vx "C:\\tmp\\puppet-\d+_\d+_\d+-\d+_\d+-installer.log"/
        should contain Exec[fix inheritable SYSTEM perms]
      default source
        should contain File[C:\tmp\install_puppet.bat] with content =~ /\/l\*vx "C:\\tmp\\puppet-\d+_\d+_\d+-\d+_\d+-installer\.log"/
        should contain Exec[install_puppet.bat]
        should not contain File[C:\tmp\puppet-agent.msi]
        should contain Exec[fix inheritable SYSTEM perms]
      puppet:///puppet_agent/puppet-agent-1.1.0-x86.msi
        should contain File[C:\tmp\install_puppet.bat] with content =~ /msiexec.exe \/qn \/norestart \/i "C:\\tmp\\puppet-agent.msi"/
        should contain Exec[fix inheritable SYSTEM perms]
    arch =>
      specify x86
        should contain File[C:\tmp\install_puppet.bat] with content =~ /msiexec.exe \/qn \/norestart \/i "https:\/\/downloads.puppetlabs.com\/windows\/puppet-agent-1.2.1.1-x86.msi"/
      try x64 on x86 system
        should raise Puppet::Error with message matching /Unable to install x64 on a x86 system/
    msi_move_locked_files =>
      default
        should contain File[C:\tmp\install_puppet.bat] with content !~ /Move puppetres\.dll/
      specify false
        should contain File[C:\tmp\install_puppet.bat] with content !~ /Move puppetres\.dll/
      specify true
        should contain File[C:\tmp\install_puppet.bat] with content =~ /Move puppetres\.dll/
  rubyplatform
    i386-ming32
      should contain Exec[install_puppet.bat]
      should contain Exec[fix inheritable SYSTEM perms]
    x86
      should contain Exec[install_puppet.bat]
      should contain Exec[fix inheritable SYSTEM perms]

Finished in 6.21 seconds (files took 2.42 seconds to load)
72 examples, 0 failures

Copy link
Contributor

@glennsarti glennsarti left a comment

Choose a reason for hiding this comment

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

It's merging time!

@jcoconnor
Copy link
Contributor Author

@glennsarti I've updated the README - is this ok ?

Set REINSTALLMODE for Puppet Agent Upgrade/Downgrade defaulting to
"amus" which forces all files to be replaced regardless of version or
checksum.

Add positive and negative testing, i.e. if OPTIONS are specified, the
REINSTALLMODE string is not included, otherwise it is.
@glennsarti glennsarti merged commit c5f2140 into puppetlabs:master Nov 15, 2017
@jcoconnor jcoconnor deleted the MODULES-5622-PA-REINSTALLMODE branch November 15, 2017 19:38
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