Skip to content

Commit 5e27e50

Browse files
committed
(MODULES-11123) Avoid loading puppet facts in install/windows.pp
The install puppet command in `manifests/install/windows.pp` is executed if the desired version is not already installed. This is done by asking facter the value of the `aio_agent_version` fact on the target node and is compared to expected package version. Before this commit, facter was asked to also load puppet facts (using the `-p` parameter) which was causing high load times due to unnecessary facts getting loaded and resolved when currently installed puppet agent version was the only information needed. This fix removes the puppet facts loading for this command requirement and lowers catalog application time by as much as half in some scenarios.
1 parent 2dc474c commit 5e27e50

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

manifests/install/windows.pp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@
109109
-NoProfile \
110110
-NoLogo \
111111
-NonInteractive \
112-
-Command {\$CurrentVersion = [string](facter.bat -p aio_agent_version); \
112+
-Command {\$CurrentVersion = [string](facter.bat aio_agent_version); \
113113
if (\$CurrentVersion -eq '${::puppet_agent::_expected_package_version}') { \
114114
exit 0; \
115115
} \

spec/classes/puppet_agent_windows_install_spec.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@
8282
{:package_version => '5.6.7'})
8383
}
8484
it {
85-
is_expected.to contain_exec('install_puppet.ps1').with_unless(/\-Command {\$CurrentVersion = \[string\]\(facter.bat \-p aio_agent_version\);/)
85+
is_expected.to contain_exec('install_puppet.ps1').with_unless(/\-Command {\$CurrentVersion = \[string\]\(facter.bat aio_agent_version\);/)
8686
is_expected.to contain_exec('install_puppet.ps1').with_unless(/\-Command.*if \(\$CurrentVersion \-eq '5\.6\.7'\) { +exit 0; *} *exit 1; }\.Invoke\(\)/)
8787
}
8888
end

0 commit comments

Comments
 (0)