dsccommunity / SqlServerDsc

This module contains DSC resources for deployment and configuration of Microsoft SQL Server.
MIT License
360 stars 227 forks source link

SqlSetup: Seems to evaluate the `SourcePath` too early for Puppet #1946

Closed unkinected closed 1 year ago

unkinected commented 1 year ago

Problem description

I'm implementing sqlsetup using puppet. In my puppet module, my first step is to copy the iso from a corporate file share and extract it, the second step is to install SQL using sqlsetup, specifying the sourcepath as the local directory from step 1.

Unfortunately the code won't ever work because sqlsetup is somehow evaluating the sourcepath before anything else (technically, it's happening in the puppet "loading facts" stage). Because my directory doesn't exist until the module runs, and loading facts comes before the module gets applied, the whole thing fails. This happens no matter how I try to build a dependency tree... dependencies, virtual resources, run stages. If sqlsetup is declared/realized anywhere in my module, it tries to evaluate the sourcepath in the loading facts stage and kills the rest of the process.

The exact error depends on whether I've extracted the ISO to a directory or just mounted it as a drive, but generally follows like this:

C:\WINDOWS\system32>puppet agent -t Info: Using environment 'production' Info: Retrieving pluginfacts Info: Retrieving plugin Info: Loading facts Error: dsc_sqlsetup: Cannot find drive. A drive with the name 'S' does not exist.

In the debug log I don't see anything related to sql during the loading facts stage, so I'm not sure what's going on in the above error.

Verbose logs

...abridged...
;36mDebug: Facter: Resolving facts sequentially
;36mDebug: Facter: resolving fact with user_query: operatingsystem
;36mDebug: Facter: Searching fact: operatingsystem in file: operatingsystem.rb
;36mDebug: Facter: Searching fact: operatingsystem in core facts and external facts
;36mDebug: Facter: Loading all internal facts
;36mDebug: Facter: List of resolvable facts: [#<Facter::SearchedFact:0x0000000008c76b38 @name="operatingsystem", @fact_class=Facts::Windows::Os::Name, @user_query="operatingsystem", @type=:legacy, @file=nil>]
;36mDebug: Facter: Loading external facts
;36mDebug: Facter: fact "operatingsystem" has resolved to: windows
;36mDebug: Could not find library 'cfpropertylist' required to enable feature 'cfpropertylist'
;36mDebug: Could not find library 'shadow' required to enable feature 'libshadow'

...abridged...

;36mDebug: Finishing transaction 11860
;36mDebug: Runtime environment: puppet_version=7.24.0, ruby_version=2.7.7, run_mode=agent, default_encoding=IBM437
;36mDebug: Loading CA certs
;36mDebug: Loading CRLs
;36mDebug: Loading/generating private key

...abridged...

;32mInfo: Retrieving pluginfacts
;36mDebug: Puppet::Network::Format[msgpack]: feature msgpack is missing
;36mDebug: Puppet::Network::Format[rich_data_msgpack]: feature msgpack is missing
;36mDebug: file_metadata supports formats: json pson yaml
;36mDebug: Using cached connection for https://puppet:8140
;36mDebug: HTTP GET https://puppet:8140/puppet/v3/file_metadatas/pluginfacts?recurse=true&max_files=-1&ignore=.svn&ignore=CVS&ignore=.git&ignore=.hg&links=follow&checksum_type=sha256&source_permissions=ignore&environment=production returned 200 OK
;36mDebug: Caching connection for https://puppet:8140
;36mDebug: Finishing transaction 12100
;32mInfo: Retrieving plugin
;36mDebug: Puppet::Network::Format[msgpack]: feature msgpack is missing
;36mDebug: Puppet::Network::Format[rich_data_msgpack]: feature msgpack is missing
;36mDebug: file_metadata supports formats: json pson yaml
;36mDebug: Using cached connection for https://puppet:8140
;36mDebug: HTTP GET https://puppet:8140/puppet/v3/file_metadatas/plugins?recurse=true&max_files=-1&ignore=.svn&ignore=CVS&ignore=.git&ignore=.hg&links=follow&checksum_type=sha256&source_permissions=ignore&environment=production returned 200 OK
;36mDebug: Caching connection for https://puppet:8140
;36mDebug: Finishing transaction 34140
;36mDebug: Reset text domain to :agent
;36mDebug: Loading external facts from C:/ProgramData/PuppetLabs/puppet/cache/facts.d
;32mInfo: Loading facts
;36mDebug: Loading facts from C:/ProgramData/PuppetLabs/puppet/cache/lib/facter/archive_windir.rb
;36mDebug: Loading facts from C:/ProgramData/PuppetLabs/puppet/cache/lib/facter/chocolateyversion.rb
;36mDebug: Loading facts from C:/ProgramData/PuppetLabs/puppet/cache/lib/facter/choco_install_path.rb
;36mDebug: Loading facts from C:/ProgramData/PuppetLabs/puppet/cache/lib/facter/choco_temp_dir.rb
;36mDebug: Loading facts from C:/ProgramData/PuppetLabs/puppet/cache/lib/facter/env_temp_variable.rb
;36mDebug: Loading facts from C:/ProgramData/PuppetLabs/puppet/cache/lib/facter/iis_version.rb
;36mDebug: Loading facts from C:/ProgramData/PuppetLabs/puppet/cache/lib/facter/package_provider.rb
;36mDebug: Loading facts from C:/ProgramData/PuppetLabs/puppet/cache/lib/facter/pe_version.rb
;36mDebug: Loading facts from C:/ProgramData/PuppetLabs/puppet/cache/lib/facter/puppet_agent_appdata.rb
;36mDebug: Loading facts from C:/ProgramData/PuppetLabs/puppet/cache/lib/facter/puppet_agent_pid.rb
;36mDebug: Loading facts from C:/ProgramData/PuppetLabs/puppet/cache/lib/facter/puppet_settings.rb
;36mDebug: Loading facts from C:/ProgramData/PuppetLabs/puppet/cache/lib/facter/root_home.rb
;36mDebug: Loading facts from C:/ProgramData/PuppetLabs/puppet/cache/lib/facter/service_provider.rb
;36mDebug: Loading facts from C:/ProgramData/PuppetLabs/puppet/cache/lib/facter/settings.rb
;36mDebug: Loading facts from C:/ProgramData/PuppetLabs/puppet/cache/lib/facter/windows_env.rb
;36mDebug: Facter: Facter version: 4.3.1
;36mDebug: Facter: Loading all internal facts
;36mDebug: Facter: Loading custom facts
;36mDebug: Facter: resolving fact with user_query: choco_install_path
;36mDebug: Facter: Searching fact: choco_install_path in file: choco_install_path.rb
;36mDebug: Facter: List of resolvable facts: [#<Facter::SearchedFact:0x000000000bfe05a0 @name="choco_install_path", @fact_class=nil, @user_query="choco_install_path", @type=:custom, @file=nil>]
;36mDebug: Facter: resolving fact with user_query: osfamily
;36mDebug: Facter: Searching fact: osfamily in file: osfamily.rb
;36mDebug: Facter: Searching fact: osfamily in core facts and external facts
;36mDebug: Facter: Loading all internal facts
;36mDebug: Facter: List of resolvable facts: [#<Facter::SearchedFact:0x000000000bffb350 @name="osfamily", @fact_class=Facts::Windows::Os::Family, @user_query="osfamily", @type=:legacy, @file=nil>]
;36mDebug: Facter: Loading external facts
;36mDebug: Facter: Executing command: "C:\WINDOWS\system32\WindowsPowershell\v1.0\powershell.exe" -NoProfile -NonInteractive -NoLogo -ExecutionPolicy Bypass -File "C:/ProgramData/PuppetLabs/puppet/cache/facts.d/SQLServer.ps1"
;36mDebug: Facter: Fact file C:/ProgramData/PuppetLabs/puppet/cache/facts.d/SQLServer.ps1 was parsed but no key=>value data was returned
;36mDebug: Facter: Executing command: "C:\WINDOWS\system32\WindowsPowershell\v1.0\powershell.exe" -NoProfile -NonInteractive -NoLogo -ExecutionPolicy Bypass -File "C:/ProgramData/PuppetLabs/puppet/cache/facts.d/IguanaInstallPaths.ps1"
;36mDebug: Facter: Fact file C:/ProgramData/PuppetLabs/puppet/cache/facts.d/IguanaInstallPaths.ps1 was parsed but no key=>value data was returned
;36mDebug: Facter: Executing command: "C:\WINDOWS\system32\WindowsPowershell\v1.0\powershell.exe" -NoProfile -NonInteractive -NoLogo -ExecutionPolicy Bypass -File "C:/ProgramData/PuppetLabs/puppet/cache/facts.d/GoServiceUser.ps1"
;36mDebug: Facter: fact "osfamily" has resolved to: windows
;36mDebug: Facter: custom fact choco_install_path got resolved from: ["C:/ProgramData/PuppetLabs/puppet/cache/lib/facter/choco_install_path.rb", 6]
;36mDebug: Facter: Searching fact: choco_install_path in core facts and external facts
;36mDebug: Facter: Loading all internal facts
;36mDebug: Facter: Loading external facts
;36mDebug: Facter: fact "choco_install_path" has resolved to: C:\ProgramData\chocolatey
;36mDebug: Facter: resolving fact with user_query: aio_agent_version
;36mDebug: Facter: Searching fact: aio_agent_version in file: aio_agent_version.rb
;36mDebug: Facter: Searching fact: aio_agent_version in core facts and external facts
;36mDebug: Facter: Loading all internal facts
;36mDebug: Facter: List of resolvable facts: [#<Facter::SearchedFact:0x000000000b038170 @name="aio_agent_version", @fact_class=Facts::Windows::AioAgentVersion, @user_query="aio_agent_version", @type=:core, @file=nil>]
;36mDebug: Facter: Loading external facts
;36mDebug: Facter: fact "aio_agent_version" has resolved to: 7.24.0
;36mDebug: Facter: Loading external facts
;36mDebug: Facter: File at: C:\ProgramData/ssh/ssh_host_rsa_key.pub is not accessible.
;36mDebug: Facter: File at: C:\ProgramData/ssh/ssh_host_dsa_key.pub is not accessible.
;36mDebug: Facter: File at: C:\ProgramData/ssh/ssh_host_ecdsa_key.pub is not accessible.
;36mDebug: Facter: File at: C:\ProgramData/ssh/ssh_host_ed25519_key.pub is not accessible.
;36mDebug: Facter: Executing command: augparse --version 2>&1
;36mDebug: Facter: Resolving fact augeas_version, but got cannot load such file -- augeas at c:/Program Files/Puppet Labs/Puppet/puppet/lib/ruby/2.7.0/rubygems/core_ext/kernel_require.rb:83:in `require'
;36mDebug: Facter: Querying Az metadata
;36mDebug: Facter: Only managed to read hostname: mymachine, no domain was found.
;36mDebug: Facter: Managed to read hostname: mymachine and domain: mydomain.com
;36mDebug: Facter: Querying Az metadata
;36mDebug: Facter: external fact env_windows_installdir got resolved from: ["c:/Program Files/Puppet Labs/Puppet/puppet/lib/ruby/vendor_ruby/facter/custom_facts/util/loader.rb", 132]
;36mDebug: Facter: external fact goserviceuserlocalpath got resolved from: C:/ProgramData/PuppetLabs/puppet/cache/facts.d/GoServiceUser.ps1
;36mDebug: Facter: custom fact puppetversion got resolved from: ["c:/Program Files/Puppet Labs/Puppet/puppet/lib/ruby/vendor_ruby/puppet.rb", 192]
;36mDebug: Facter: Loading all internal facts
;36mDebug: Facter: custom fact agent_specified_environment got resolved from: ["c:/Program Files/Puppet Labs/Puppet/puppet/lib/ruby/vendor_ruby/puppet.rb", 196]
;36mDebug: Facter: Loading all internal facts
;36mDebug: Facter: custom fact archive_windir got resolved from: ["C:/ProgramData/PuppetLabs/puppet/cache/lib/facter/archive_windir.rb", 3]
;36mDebug: Executing: 'C:\ProgramData\chocolatey\choco.exe -v'
;36mDebug: Facter: custom fact chocolateyversion got resolved from: ["C:/ProgramData/PuppetLabs/puppet/cache/lib/facter/chocolateyversion.rb", 6]
;36mDebug: Facter: custom fact choco_temp_dir got resolved from: ["C:/ProgramData/PuppetLabs/puppet/cache/lib/facter/choco_temp_dir.rb", 6]
;36mDebug: Facter: custom fact env_temp_variable got resolved from: ["C:/ProgramData/PuppetLabs/puppet/cache/lib/facter/env_temp_variable.rb", 3]
;36mDebug: Facter: Loading all internal facts
;36mDebug: Facter: resolving fact with user_query: kernel
;36mDebug: Facter: Searching fact: kernel in file: kernel.rb
;36mDebug: Facter: Searching fact: kernel in core facts and external facts
;36mDebug: Facter: Loading all internal facts
;36mDebug: Facter: List of resolvable facts: [#<Facter::SearchedFact:0x000000000b764d18 @name="kernel", @fact_class=Facts::Windows::Kernel, @user_query="kernel", @type=:core, @file=nil>]
;36mDebug: Facter: Loading external facts
;36mDebug: Facter: fact "kernel" has resolved to: windows
;36mDebug: Facter: custom fact iis_version got resolved from: ["C:/ProgramData/PuppetLabs/puppet/cache/lib/facter/iis_version.rb", 3]
;36mDebug: Puppet::Type::Package::ProviderAix: file /usr/bin/lslpp does not exist
;36mDebug: Puppet::Type::Package::ProviderDpkg: file /usr/bin/dpkg does not exist
;36mDebug: Puppet::Type::Package::ProviderApt: file /usr/bin/apt-get does not exist
;36mDebug: Puppet::Type::Package::ProviderAptitude: file /usr/bin/aptitude does not exist
;36mDebug: Puppet::Type::Package::ProviderRpm: file rpm does not exist
;36mDebug: Puppet::Type::Package::ProviderAptrpm: file apt-get does not exist
;36mDebug: Puppet::Type::Package::ProviderSun: file /usr/bin/pkginfo does not exist
;36mDebug: Puppet::Type::Package::ProviderYum: file yum does not exist
;36mDebug: Puppet::Type::Package::ProviderDnf: file dnf does not exist
;36mDebug: Puppet::Type::Package::ProviderDnfmodule: file /usr/bin/dnf does not exist
;36mDebug: Puppet::Type::Package::ProviderFink: file /sw/bin/fink does not exist
;36mDebug: Puppet::Type::Package::ProviderOpenbsd: file pkg_info does not exist
;36mDebug: Puppet::Type::Package::ProviderFreebsd: file /usr/sbin/pkg_info does not exist
;36mDebug: Puppet::Type::Package::ProviderHpux: file /usr/sbin/swinstall does not exist
;36mDebug: Puppet::Type::Package::ProviderNim: file /usr/sbin/nimclient does not exist
;36mDebug: Puppet::Type::Package::ProviderOpkg: file opkg does not exist
;36mDebug: Puppet::Type::Package::ProviderPacman: file /usr/bin/pacman does not exist
;36mDebug: Puppet::Type::Package::ProviderPkg: file /usr/bin/pkg does not exist
;36mDebug: Puppet::Type::Package::ProviderPkgin: file pkgin does not exist
;36mDebug: Puppet::Type::Package::ProviderPkgng: file /usr/local/sbin/pkg does not exist
;36mDebug: Puppet::Type::Package::ProviderPortage: file /usr/bin/emerge does not exist
;36mDebug: Puppet::Type::Package::ProviderPorts: file /usr/local/sbin/portupgrade does not exist
;36mDebug: Puppet::Type::Package::ProviderPortupgrade: file /usr/local/sbin/portupgrade does not exist
;36mDebug: Facter: resolving fact with user_query: fips_enabled
;36mDebug: Facter: Searching fact: fips_enabled in file: fips_enabled.rb
;36mDebug: Facter: Searching fact: fips_enabled in core facts and external facts
;36mDebug: Facter: Loading all internal facts
;36mDebug: Facter: List of resolvable facts: [#<Facter::SearchedFact:0x0000000009cdeca0 @name="fips_enabled", @fact_class=Facts::Windows::FipsEnabled, @user_query="fips_enabled", @type=:core, @file=nil>]
;36mDebug: Facter: Loading external facts
;36mDebug: Facter: fact "fips_enabled" has resolved to: false
;36mDebug: Puppet::Type::Package::ProviderPuppetserver_gem: file /opt/puppetlabs/bin/puppetserver does not exist
;36mDebug: Puppet::Type::Package::ProviderRug: file /usr/bin/rug does not exist
;36mDebug: Puppet::Type::Package::ProviderSunfreeware: file pkg-get does not exist
;36mDebug: Puppet::Type::Package::ProviderTdnf: file tdnf does not exist
;36mDebug: Puppet::Type::Package::ProviderUp2date: file /usr/sbin/up2date-nox does not exist
;36mDebug: Puppet::Type::Package::ProviderUrpmi: file urpmi does not exist
;36mDebug: Puppet::Type::Package::ProviderZypper: file /usr/bin/zypper does not exist
;36mDebug: /Package[dummy]: Provider windows does not support features virtual_packages; not managing attribute allow_virtual
;36mDebug: /Package[dummy]: Provider windows does not support features targetable; not managing attribute command
;36mDebug: /Package[dummy]: Provider windows does not support features install_only; not managing attribute install_only
;36mDebug: Facter: custom fact package_provider got resolved from: ["C:/ProgramData/PuppetLabs/puppet/cache/lib/facter/package_provider.rb", 16]
;36mDebug: Facter: Loading all internal facts
;36mDebug: Facter: resolving fact with user_query: pe_build
;36mDebug: Facter: Searching fact: pe_build in file: pe_build.rb
;36mDebug: Facter: Searching fact: pe_build in core facts and external facts
;36mDebug: Facter: Loading all internal facts
;36mDebug: Facter: Loading external facts
;36mDebug: Facter: Searching fact: pe_build in all custom facts
;36mDebug: Facter: Loading custom facts
;36mDebug: Facter: resolving fact with user_query: puppetversion
;36mDebug: Facter: Searching fact: puppetversion in file: puppetversion.rb
;36mDebug: Facter: List of resolvable facts: [#<Facter::SearchedFact:0x000000000bbe2cc8 @name="puppetversion", @fact_class=nil, @user_query="puppetversion", @type=:custom, @file=nil>]
;36mDebug: Facter: Searching fact: puppetversion in core facts and external facts
;36mDebug: Facter: Loading all internal facts
;36mDebug: Facter: Loading external facts
;36mDebug: Facter: fact "puppetversion" has resolved to: 7.24.0
;36mDebug: Facter: value for pe_version is still nil
;36mDebug: Facter: Loading all internal facts
;36mDebug: Facter: resolving fact with user_query: pe_version
;36mDebug: Facter: Searching fact: pe_version in file: pe_version.rb
;36mDebug: Facter: List of resolvable facts: [#<Facter::SearchedFact:0x000000000bcb15f0 @name="pe_version", @fact_class=nil, @user_query="pe_version", @type=:custom, @file=nil>]
;36mDebug: Facter: resolving fact with user_query: pe_build
;36mDebug: Facter: Searching fact: pe_build in file: pe_build.rb
;36mDebug: Facter: Searching fact: pe_build in core facts and external facts
;36mDebug: Facter: Loading all internal facts
;36mDebug: Facter: Loading external facts
;36mDebug: Facter: Searching fact: pe_build in all custom facts
;36mDebug: Facter: Loading custom facts
;36mDebug: Facter: value for pe_version is still nil
;36mDebug: Facter: Loading all internal facts
;36mDebug: Facter: Searching fact: pe_version in core facts and external facts
;36mDebug: Facter: Loading all internal facts
;36mDebug: Facter: Loading external facts
;36mDebug: Facter: custom fact is_pe got resolved from: ["C:/ProgramData/PuppetLabs/puppet/cache/lib/facter/pe_version.rb", 31]
;36mDebug: Facter: Loading all internal facts
;36mDebug: Facter: resolving fact with user_query: is_pe
;36mDebug: Facter: Searching fact: is_pe in file: is_pe.rb
;36mDebug: Facter: List of resolvable facts: [#<Facter::SearchedFact:0x000000000a1a56d0 @name="is_pe", @fact_class=nil, @user_query="is_pe", @type=:custom, @file=nil>]
;36mDebug: Facter: Searching fact: is_pe in core facts and external facts
;36mDebug: Facter: Loading all internal facts
;36mDebug: Facter: Loading external facts
;36mDebug: Facter: fact "is_pe" has resolved to: false
;36mDebug: Facter: Found no suitable resolves of  1.000000or pe_major_version
;36mDebug: Facter: value for pe_major_version is still nil
;36mDebug: Facter: Loading all internal facts
;36mDebug: Facter: Found no suitable resolves of  1.000000or pe_minor_version
;36mDebug: Facter: value for pe_minor_version is still nil
;36mDebug: Facter: Loading all internal facts
;36mDebug: Facter: Found no suitable resolves of  1.000000or pe_patch_version
;36mDebug: Facter: value for pe_patch_version is still nil
;36mDebug: Facter: Loading all internal facts
;36mDebug: Facter: custom fact puppet_agent_appdata got resolved from: ["C:/ProgramData/PuppetLabs/puppet/cache/lib/facter/puppet_agent_appdata.rb", 1]
;36mDebug: Facter: Loading all internal facts
;36mDebug: Facter: custom fact puppet_agent_pid got resolved from: ["C:/ProgramData/PuppetLabs/puppet/cache/lib/facter/puppet_agent_pid.rb", 1]
;36mDebug: Facter: Loading all internal facts
;36mDebug: Facter: custom fact puppet_vardir got resolved from: ["C:/ProgramData/PuppetLabs/puppet/cache/lib/facter/puppet_settings.rb", 22]
;36mDebug: Facter: Loading all internal facts
;36mDebug: Facter: custom fact puppet_environmentpath got resolved from: ["C:/ProgramData/PuppetLabs/puppet/cache/lib/facter/puppet_settings.rb", 31]
;36mDebug: Facter: Loading all internal facts
;36mDebug: Facter: custom fact puppet_server got resolved from: ["C:/ProgramData/PuppetLabs/puppet/cache/lib/facter/puppet_settings.rb", 40]
;36mDebug: Facter: Loading all internal facts
;36mDebug: Facter: value for root_home is still nil
;36mDebug: Facter: Loading all internal facts
;36mDebug: Puppet::Type::Service::ProviderBase: file kill does not exist
;36mDebug: Puppet::Type::Service::ProviderDaemontools: file /usr/bin/svc does not exist
;36mDebug: Puppet::Type::Service::ProviderDebian: file /usr/sbin/update-rc.d does not exist
;36mDebug: Puppet::Type::Service::ProviderGentoo: file /sbin/rc-update does not exist
;36mDebug: Puppet::Type::Service::ProviderLaunchd: file /bin/launchctl does not exist
;36mDebug: Puppet::Type::Service::ProviderOpenbsd: file /usr/sbin/rcctl does not exist
;36mDebug: Puppet::Type::Service::ProviderOpenrc: file /bin/rc-status does not exist
;36mDebug: Puppet::Type::Service::ProviderRedhat: file /sbin/chkconfig does not exist
;36mDebug: Puppet::Type::Service::ProviderRunit: file /usr/bin/sv does not exist
;36mDebug: Puppet::Type::Service::ProviderSystemd: file systemctl does not exist
;36mDebug: Puppet::Type::Service::ProviderUpstart: 0 confines (of 4) were true
;36mDebug: Facter: custom fact service_provider got resolved from: ["C:/ProgramData/PuppetLabs/puppet/cache/lib/facter/service_provider.rb", 15]
;36mDebug: Facter: Loading all internal facts
;36mDebug: Facter: custom fact puppet_ssldir got resolved from: ["C:/ProgramData/PuppetLabs/puppet/cache/lib/facter/settings.rb", 3]
;36mDebug: Facter: Loading all internal facts
;36mDebug: Facter: custom fact puppet_digest_algorithm got resolved from: ["C:/ProgramData/PuppetLabs/puppet/cache/lib/facter/settings.rb", 9]
;36mDebug: Facter: Loading all internal facts
;36mDebug: Facter: custom fact puppet_config got resolved from: ["C:/ProgramData/PuppetLabs/puppet/cache/lib/facter/settings.rb", 15]
;36mDebug: Facter: Loading all internal facts
;36mDebug: Facter: custom fact puppet_stringify_facts got resolved from: ["C:/ProgramData/PuppetLabs/puppet/cache/lib/facter/settings.rb", 21]
;36mDebug: Facter: Loading all internal facts
;36mDebug: Facter: custom fact puppet_sslpaths got resolved from: ["C:/ProgramData/PuppetLabs/puppet/cache/lib/facter/settings.rb", 27]
;36mDebug: Facter: Loading all internal facts
;36mDebug: Facter: custom fact puppet_master_server got resolved from: ["C:/ProgramData/PuppetLabs/puppet/cache/lib/facter/settings.rb", 43]
;36mDebug: Facter: Loading all internal facts
;36mDebug: Facter: custom fact puppet_confdir got resolved from: ["C:/ProgramData/PuppetLabs/puppet/cache/lib/facter/settings.rb", 59]
;36mDebug: Facter: Loading all internal facts
;36mDebug: Facter: custom fact puppet_client_datadir got resolved from: ["C:/ProgramData/PuppetLabs/puppet/cache/lib/facter/settings.rb", 65]
;36mDebug: Facter: Loading all internal facts
;36mDebug: Facter: custom fact windows_env got resolved from: ["C:/ProgramData/PuppetLabs/puppet/cache/lib/facter/windows_env.rb", 1]
;36mDebug: Facter: fact "path" has resolved to: c:\Program Files\Puppet Labs\Puppet\puppet\bin;c:\Program Files\Puppet Labs\Puppet\bin;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\Program Files (x86)\Microsoft SQL Server\Client SDK\ODBC\130\Tools\Binn\;C:\Program Files (x86)\Microsoft SQL Server\140\Tools\Binn\;C:\Program Files (x86)\Microsoft SQL Server\140\DTS\Binn\;C:\Program Files (x86)\Microsoft SQL Server\140\Tools\Binn\ManagementStudio\;C:\Program Files\dotnet\;C:\ProgramData\chocolatey\bin;C:\WINDOWS\System32\OpenSSH\;C:\Program Files\Microsoft SQL Server\150\Tools\Binn\;c:\Program Files\Puppet Labs\Puppet\bin;C:\Tools\nvm\;C:\Tools\nvm\nodejs\;c:\tools\installers\Android\cmdline-tools\tools\latest;C:\Tools\nvm\;C:\Tools\nvm\nodejs\;C:\Tools\nvm\;C:\Tools\nvm\nodejs\;C:\Program Files\OpenJDK\jdk-15.0.2\bin;C:\WINDOWS\system32\config\systemprofile\AppData\Local\Microsoft\WindowsApps
;36mDebug: Facter: fact "network_Ethernet 3" has resolved to: 10.0.5.224
;36mDebug: Facter: fact "os.name" has resolved to: windows
;36mDebug: Facter: fact "operatingsystem" has resolved to: windows
;36mDebug: Facter: fact "os.release" has resolved to: {"full"=>"2022", "major"=>"2022"}
;36mDebug: Facter: fact "operatingsystemmajrelease" has resolved to: 2022
;36mDebug: Facter: fact "operatingsystemrelease" has resolved to: 2022
;36mDebug: Facter: fact "os.architecture" has resolved to: x64
;36mDebug: Facter: fact "architecture" has resolved to: x64
;36mDebug: Facter: fact "os.windows.system32" has resolved to: C:\WINDOWS\system32
;36mDebug: Facter: fact "system32" has resolved to: C:\WINDOWS\system32
;36mDebug: Facter: fact "os.windows.edition_id" has resolved to: ServerDatacenter
;36mDebug: Facter: fact "windows_edition_id" has resolved to: ServerDatacenter
;36mDebug: Facter: fact "os.windows.installation_type" has resolved to: Server
;36mDebug: Facter: fact "windows_installation_type" has resolved to: Server
;36mDebug: Facter: fact "os.windows.product_name" has resolved to: Windows Server 2022 Datacenter
;36mDebug: Facter: fact "windows_product_name" has resolved to: Windows Server 2022 Datacenter
;36mDebug: Facter: fact "os.windows.display_version" has resolved to: 21H2
;36mDebug: Facter: fact "windows_display_version" has resolved to: 21H2
;36mDebug: Facter: fact "os.windows.release_id" has resolved to: 21H2
;36mDebug: Facter: fact "windows_release_id" has resolved to: 21H2
;36mDebug: Facter: fact "os.family" has resolved to: windows
;36mDebug: Facter: fact "osfamily" has resolved to: windows
;36mDebug: Facter: fact "os.hardware" has resolved to: x86_64
;36mDebug: Facter: fact "hardwaremodel" has resolved to: x86_64
;36mDebug: Facter: fact "hypervisors.hyperv" has resolved to: {}
;36mDebug: Facter: fact "memory.system.available" has resolved to: 2.72 GiB
;36mDebug: Facter: fact "memoryfree" has resolved to: 2.72 GiB
;36mDebug: Facter: fact "memory.system.available_bytes" has resolved to: 2917330944
;36mDebug: Facter: fact "memoryfree_mb" has resolved to: 2782.18359375
;36mDebug: Facter: fact "memory.system.capacity" has resolved to: 61.18%
;36mDebug: Facter: fact "memory.system.total" has resolved to: 7.00 GiB
;36mDebug: Facter: fact "memorysize" has resolved to: 7.00 GiB
;36mDebug: Facter: fact "memory.system.total_bytes" has resolved to: 7515721728
;36mDebug: Facter: fact "memorysize_mb" has resolved to: 7167.55078125
;36mDebug: Facter: fact "memory.system.used" has resolved to: 4.28 GiB
;36mDebug: Facter: fact "memory.system.used_bytes" has resolved to: 4598390784
;36mDebug: Facter: fact "ruby.version" has resolved to: 2.7.7
;36mDebug: Facter: fact "rubyversion" has resolved to: 2.7.7
;36mDebug: Facter: fact "ruby.platform" has resolved to: x64-mingw32
;36mDebug: Facter: fact "rubyplatform" has resolved to: x64-mingw32
;36mDebug: Facter: fact "ruby.sitedir" has resolved to: c:/Program Files/Puppet Labs/Puppet/puppet/lib/ruby/site_ruby/2.7.0
;36mDebug: Facter: fact "rubysitedir" has resolved to: c:/Program Files/Puppet Labs/Puppet/puppet/lib/ruby/site_ruby/2.7.0
;36mDebug: Facter: fact "aio_agent_version" has resolved to: 7.24.0
;36mDebug: Facter: fact "facterversion" has resolved to: 4.3.1
;36mDebug: Facter: fact "identity.user" has resolved to: mydomain\mymachine$
;36mDebug: Facter: fact "id" has resolved to: mydomain\mymachine$
;36mDebug: Facter: fact "identity.privileged" has resolved to: true
;36mDebug: Facter: fact "processor0" has resolved to: Intel(R) Xeon(R) Platinum 8171M CPU @ 2.60GHz
;36mDebug: Facter: fact "interfaces" has resolved to: Ethernet 3
;36mDebug: Facter: fact "ipaddress6_Ethernet 3" has resolved to: fe80::86f1:73dd:8294:c062
;36mDebug: Facter: fact "fips_enabled" has resolved to: false
;36mDebug: Facter: fact "ipaddress_Ethernet 3" has resolved to: 10.0.5.229
;36mDebug: Facter: fact "is_virtual" has resolved to: true
;36mDebug: Facter: fact "kernelmajversion" has resolved to: 10.0
;36mDebug: Facter: fact "kernelrelease" has resolved to: 10.0.20348
;36mDebug: Facter: fact "kernelversion" has resolved to: 10.0.20348
;36mDebug: Facter: fact "macaddress_Ethernet 3" has resolved to: 00:0D:3A:03:21:E1
;36mDebug: Facter: fact "scope6_Ethernet 3" has resolved to: link
;36mDebug: Facter: fact "timezone" has resolved to: Eastern Daylight Time
;36mDebug: Facter: fact "system_uptime.days" has resolved to: 7
;36mDebug: Facter: fact "uptime_days" has resolved to: 7
;36mDebug: Facter: fact "system_uptime.hours" has resolved to: 183
;36mDebug: Facter: fact "uptime_hours" has resolved to: 183
;36mDebug: Facter: fact "system_uptime.seconds" has resolved to: 660743
;36mDebug: Facter: fact "uptime_seconds" has resolved to: 660743
;36mDebug: Facter: fact "system_uptime.uptime" has resolved to: 7 days
;36mDebug: Facter: fact "uptime" has resolved to: 7 days
;36mDebug: Facter: fact "mtu_Ethernet 3" has resolved to: 1500
;36mDebug: Facter: fact "netmask6_Ethernet 3" has resolved to: ffff:ffff:ffff:ffff::
;36mDebug: Facter: fact "netmask_Ethernet 3" has resolved to: 255.255.255.240
;36mDebug: Facter: fact "network6_Ethernet 3" has resolved to: fe80::
;36mDebug: Facter: fact "kernel" has resolved to: windows
;36mDebug: Facter: fact "az_metadata" has resolved to: {"compute"=>{"azEnvironment"=>"AzurePublicCloud", "customData"=>"", "isHostCompatibilityLayerVm"=>"false", "licenseType"=>"Windows_Server", "location"=>"eastus2", "name"=>"vxcazjmp02", "offer"=>"WindowsServer", "osProfile"=>{"adminUsername"=>"vxcadmin", "computerName"=>"vxcazjmp02"}, "osType"=>"Windows", "placementGroupId"=>"", "plan"=>{"name"=>"", "product"=>"", "publisher"=>""}, "platformFaultDomain"=>"0", "platformUpdateDomain"=>"0", "provider"=>"Microsoft.Compute", "publicKeys"=>[], "publisher"=>"MicrosoftWindowsServer", "resourceGroupName"=>"rg_prod", "resourceId"=>"/subscriptions/e5f28aca-f0fa-43c9-b1af-c2c217c18cbb/resourceGroups/rg_prod/providers/Microsoft.Compute/virtualMachines/vxcazjmp02", "securityProfile"=>{"secureBootEnabled"=>"false", "virtualTpmEnabled"=>"false"}, "sku"=>"2016-Datacenter", "storageProfile"=>{"dataDisks"=>[], "imageReference"=>{"id"=>"", "offer"=>"WindowsServer", "publisher"=>"MicrosoftWindowsServer", "sku"=>"2016-Datacenter", "version"=>"latest"}, "osDisk"=>{"caching"=>"ReadWrite", "createOption"=>"FromImage", "diffDiskSettings"=>{"option"=>""}, "diskSizeGB"=>"127", "encryptionSettings"=>{"enabled"=>"false"}, "image"=>{"uri"=>""}, "managedDisk"=>{"id"=>"/subscriptions/e5f28aca-f0fa-43c9-b1af-c2c217c18cbb/resourceGroups/RG_PROD/providers/Microsoft.Compute/disks/vxcazjmp02_OsDisk_1_79e509952efe4789a0234c0efe722db5", "storageAccountType"=>"Premium_LRS"}, "name"=>"vxcazjmp02_OsDisk_1_79e509952efe4789a0234c0efe722db5", "osType"=>"Windows", "vhd"=>{"uri"=>""}, "writeAcceleratorEnabled"=>"false"}}, "subscriptionId"=>"e5f28aca-f0fa-43c9-b1af-c2c217c18cbb", "tags"=>"IT:Jump;Sensitive:No;WinUpdate:STD", "tagsList"=>[{"name"=>"IT", "value"=>"Jump"}, {"name"=>"Sensitive", "value"=>"No"}, {"name"=>"WinUpdate", "value"=>"STD"}], "version"=>"2016.127.20171217", "vmId"=>"38cc5316-2b67-4846-a1b0-b0b0e88b39a3", "vmScaleSetName"=>"", "vmSize"=>"Standard_DS2_v2", "zone"=>""}, "network"=>{"interface"=>[{"ipv4"=>{"ipAddress"=>[{"privateIpAddress"=>"10.0.5.229", "publicIpAddress"=>"13.68.108.207"}], "subnet"=>[{"address"=>"10.0.5.224", "prefix"=>"28"}]}, "ipv6"=>{"ipAddress"=>[]}, "macAddress"=>"000D3A0321E1"}]}}
;36mDebug: Facter: fact "networking.primary" has resolved to: Ethernet 3
;36mDebug: Facter: fact "networking.scope6" has resolved to: link
;36mDebug: Facter: fact "scope6" has resolved to: link
;36mDebug: Facter: fact "networking.network" has resolved to: 10.0.5.224
;36mDebug: Facter: fact "network" has resolved to: 10.0.5.224
;36mDebug: Facter: fact "networking.hostname" has resolved to: vxcazjmp02
;36mDebug: Facter: fact "hostname" has resolved to: vxcazjmp02
;36mDebug: Facter: fact "networking.dhcp" has resolved to: 168.63.129.16
;36mDebug: Facter: fact "networking.domain" has resolved to: mydomain.com
;36mDebug: Facter: fact "domain" has resolved to: mydomain.com
;36mDebug: Facter: fact "networking.fqdn" has resolved to: mymachine
;36mDebug: Facter: fact "fqdn" has resolved to: mymachine
;36mDebug: Facter: fact "networking.ip" has resolved to: 10.0.5.229
;36mDebug: Facter: fact "ipaddress" has resolved to: 10.0.5.229
;36mDebug: Facter: fact "networking.ip6" has resolved to: fe80::86f1:73dd:8294:c062
;36mDebug: Facter: fact "ipaddress6" has resolved to: fe80::86f1:73dd:8294:c062
;36mDebug: Facter: fact "networking.mac" has resolved to: 00:0D:3A:03:21:E1
;36mDebug: Facter: fact "macaddress" has resolved to: 00:0D:3A:03:21:E1
;36mDebug: Facter: fact "networking.mtu" has resolved to: 1500
;36mDebug: Facter: fact "networking.netmask" has resolved to: 255.255.255.240
;36mDebug: Facter: fact "netmask" has resolved to: 255.255.255.240
;36mDebug: Facter: fact "networking.netmask6" has resolved to: ffff:ffff:ffff:ffff::
;36mDebug: Facter: fact "netmask6" has resolved to: ffff:ffff:ffff:ffff::
;36mDebug: Facter: fact "networking.network6" has resolved to: fe80::
;36mDebug: Facter: fact "network6" has resolved to: fe80::
;36mDebug: Facter: fact "networking.interfaces" has resolved to: {"Ethernet 3"=>{"dhcp"=>"168.63.129.16", "mtu"=>1500, "bindings"=>[{"address"=>"10.0.5.229", "netmask"=>"255.255.255.240", "network"=>"10.0.5.224"}], "bindings6"=>[{"address"=>"fe80::86f1:73dd:8294:c062", "netmask"=>"ffff:ffff:ffff:ffff::", "network"=>"fe80::", "scope6"=>"link"}], "mac"=>"00:0D:3A:03:21:E1", "ip"=>"10.0.5.229", "netmask"=>"255.255.255.240", "network"=>"10.0.5.224", "ip6"=>"fe80::86f1:73dd:8294:c062", "netmask6"=>"ffff:ffff:ffff:ffff::", "network6"=>"fe80::", "scope6"=>"link"}}
;36mDebug: Facter: fact "virtual" has resolved to: hyperv
;36mDebug: Facter: fact "cloud.provider" has resolved to: azure
;36mDebug: Facter: fact "dhcp_servers" has resolved to: {"system"=>"168.63.129.16", "Ethernet 3"=>"168.63.129.16"}
;36mDebug: Facter: fact "processors.threads" has resolved to: 1
;36mDebug: Facter: fact "processors.cores" has resolved to: 2
;36mDebug: Facter: fact "processors.count" has resolved to: 2
;36mDebug: Facter: fact "processorcount" has resolved to: 2
;36mDebug: Facter: fact "processors.isa" has resolved to: x64
;36mDebug: Facter: fact "hardwareisa" has resolved to: x64
;36mDebug: Facter: fact "processors.models" has resolved to: ["Intel(R) Xeon(R) Platinum 8171M CPU @ 2.60GHz"]
;36mDebug: Facter: fact "processors.physicalcount" has resolved to: 1
;36mDebug: Facter: fact "physicalprocessorcount" has resolved to: 1
;36mDebug: Facter: fact "dmi.product.name" has resolved to: Virtual Machine
;36mDebug: Facter: fact "productname" has resolved to: Virtual Machine
;36mDebug: Facter: fact "dmi.product.serial_number" has resolved to: 0000-0004-0927-3751-6055-5131-58
;36mDebug: Facter: fact "serialnumber" has resolved to: 0000-0004-0927-3751-6055-5131-58
;36mDebug: Facter: fact "dmi.product.uuid" has resolved to: 38CC5316-2B67-4846-A1B0-B0B0E88B39A3
;36mDebug: Facter: fact "uuid" has resolved to: 38CC5316-2B67-4846-A1B0-B0B0E88B39A3
;36mDebug: Facter: fact "dmi.manufacturer" has resolved to: American Megatrends Inc.
;36mDebug: Facter: fact "manufacturer" has resolved to: American Megatrends Inc.
;36mDebug: Facter: fact "env_windows_installdir" has resolved to: c:\Program Files\Puppet Labs\Puppet
;36mDebug: Facter: fact "goserviceuserlocalpath" has resolved to: C:\Users\goservice
;36mDebug: Facter: fact "puppetversion" has resolved to: 7.24.0
;36mDebug: Facter: fact "agent_specified_environment" has resolved to: production
;36mDebug: Facter: fact "archive_windir" has resolved to: C:\ProgramData\staging
;36mDebug: Facter: fact "chocolateyversion" has resolved to: 1.3.1
;36mDebug: Facter: fact "choco_install_path" has resolved to: C:\ProgramData\chocolatey
;36mDebug: Facter: fact "choco_temp_dir" has resolved to: C:\WINDOWS\system32\config\systemprofile\AppData\Local\Temp
;36mDebug: Facter: fact "env_temp_variable" has resolved to: C:\WINDOWS\TEMP
;36mDebug: Facter: fact "iis_version" has resolved to: 10.0
;36mDebug: Facter: fact "package_provider" has resolved to: windows
;36mDebug: Facter: fact "is_pe" has resolved to: false
;36mDebug: Facter: fact "puppet_agent_appdata" has resolved to: C:\ProgramData
;36mDebug: Facter: fact "puppet_agent_pid" has resolved to: 9100
;36mDebug: Facter: fact "puppet_vardir" has resolved to: C:/ProgramData/PuppetLabs/puppet/cache
;36mDebug: Facter: fact "puppet_environmentpath" has resolved to: C:/ProgramData/PuppetLabs/code/environments
;36mDebug: Facter: fact "puppet_server" has resolved to: puppet
;36mDebug: Facter: fact "service_provider" has resolved to: windows
;36mDebug: Facter: fact "puppet_ssldir" has resolved to: C:/ProgramData/PuppetLabs/puppet/etc/ssl
;36mDebug: Facter: fact "puppet_digest_algorithm" has resolved to: sha256
;36mDebug: Facter: fact "puppet_config" has resolved to: C:/ProgramData/PuppetLabs/puppet/etc/puppet.conf
;36mDebug: Facter: fact "puppet_stringify_facts" has resolved to: false
;36mDebug: Facter: fact "puppet_sslpaths" has resolved to: {"privatedir"=>{"path"=>"C:/ProgramData/PuppetLabs/puppet/etc/ssl/private", "path_exists"=>true}, "privatekeydir"=>{"path"=>"C:/ProgramData/PuppetLabs/puppet/etc/ssl/private_keys", "path_exists"=>true}, "publickeydir"=>{"path"=>"C:/ProgramData/PuppetLabs/puppet/etc/ssl/public_keys", "path_exists"=>true}, "certdir"=>{"path"=>"C:/ProgramData/PuppetLabs/puppet/etc/ssl/certs", "path_exists"=>true}, "requestdir"=>{"path"=>"C:/ProgramData/PuppetLabs/puppet/etc/ssl/certificate_requests", "path_exists"=>true}, "hostcrl"=>{"path"=>"C:/ProgramData/PuppetLabs/puppet/etc/ssl/crl.pem", "path_exists"=>true}}
;36mDebug: Facter: fact "puppet_master_server" has resolved to: puppet
;36mDebug: Facter: fact "puppet_confdir" has resolved to: C:/ProgramData/PuppetLabs/puppet/etc
;36mDebug: Facter: fact "puppet_client_datadir" has resolved to: C:/ProgramData/PuppetLabs/puppet/cache/client_data
;36mDebug: Facter: fact "windows_env" has resolved to: {"ALLUSERSPROFILE"=>"C:\\ProgramData", "APPDATA"=>"C:\\WINDOWS\\system32\\config\\systemprofile\\AppData\\Roaming", "COMMONPROGRAMFILES"=>"C:\\Program Files\\Common Files", "COMMONPROGRAMFILES(X86)"=>"C:\\Program Files (x86)\\Common Files", "HOME"=>"C:/WINDOWS/system32/config/systemprofile", "LOCALAPPDATA"=>"C:\\WINDOWS\\system32\\config\\systemprofile\\AppData\\Local", "PATHEXT"=>".COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.MSC", "PROCESSOR_IDENTIFIER"=>"Intel64 Family 6 Model 85 Stepping 4, GenuineIntel", "PROCESSOR_LEVEL"=>"6", "PROCESSOR_REVISION"=>"5504", "PROGRAMDATA"=>"C:\\ProgramData", "PROGRAMFILES"=>"C:\\Program Files", "PROGRAMFILES(X86)"=>"C:\\Program Files (x86)", "PSMODULEPATH"=>"C:\\Program Files\\WindowsPowerShell\\Modules;C:\\Windows\\system32\\WindowsPowerShell\\v1.0\\Modules;C:\\Program Files\\Microsoft Monitoring Agent\\Agent\\PowerShell\\;C:\\Program Files\\Microsoft Monitoring Agent\\Agent\\AzureAutomation\\7.3.1699.3", "PUBLIC"=>"C:\\Users\\Public", "SYSTEMDRIVE"=>"C:", "SYSTEMROOT"=>"C:\\WINDOWS", "TEMP"=>"C:\\WINDOWS\\TEMP", "TMP"=>"C:\\WINDOWS\\TEMP", "USERPROFILE"=>"C:\\WINDOWS\\system32\\config\\systemprofile", "WINDIR"=>"C:\\WINDOWS"}
;36mDebug: The total number of facts registered is 306
;36mDebug: The size of the payload is 15259
;36mDebug: Resolving service 'puppet' using Puppet::HTTP::Resolver::Settings
;36mDebug: Closing connection for https://puppet:8140
;36mDebug: Creating new connection for https://puppet:8140
;36mDebug: Starting connection for https://puppet:8140
;36mDebug: Using TLSv1.2 with cipher DHE-RSA-AES128-GCM-SHA256
;36mDebug: Caching connection for https://puppet:8140
;36mDebug: Resolved service 'puppet' to https://puppet:8140/puppet/v3
;36mDebug: Puppet::Network::Format[msgpack]: feature msgpack is missing
;36mDebug: Puppet::Network::Format[rich_data_msgpack]: feature msgpack is missing
;36mDebug: catalog supports formats: rich_data_json json pson dot yaml
;36mDebug: Using cached connection for https://puppet:8140
;36mDebug: HTTP POST https://puppet:8140/puppet/v3/catalog/mymachine?environment=production returned 200 OK
;36mDebug: Caching connection for https://puppet:8140
;36mDebug: Puppet::Type::Group::ProviderDirectoryservice: file /usr/bin/dscl does not exist
;36mDebug: Puppet::Type::Group::ProviderGroupadd: file groupadd does not exist
;36mDebug: Could not find library 'ldap' required to enable feature 'ldap'
;36mDebug: Puppet::Type::Group::ProviderLdap: feature ldap is missing
;36mDebug: Puppet::Type::Group::ProviderPw: file pw does not exist
;36mDebug: /Group[Administrators]: Provider windows_adsi does not support features manages_local_users_and_groups; not managing attribute forcelocal
;36mDebug: /Group[Remote Desktop Users]: Provider windows_adsi does not support features manages_local_users_and_groups; not managing attribute forcelocal
;36mDebug: dsc_timezone: retrieving {:name=>"Windows_env['computername']_TimeZone", :dsc_issingleinstance=>"Yes", :dsc_timezone=>"Eastern Standard Time"}
;36mDebug: dsc_timezone: invocable_resource: {:parameters=>{:dsc_issingleinstance=>{:value=>"Yes", :mof_type=>"String", :mof_is_embedded=>false}, :dsc_timezone=>{:value=>"Eastern Standard Time", :mof_type=>"String", :mof_is_embedded=>false}}, :name=>"dsc_timezone", :dscmeta_resource_friendly_name=>"TimeZone", :dscmeta_resource_name=>"DSC_TimeZone", :dscmeta_resource_implementation=>"Class", :dscmeta_module_name=>"ComputerManagementDsc", :dscmeta_module_version=>"8.5.0", :dsc_invoke_method=>"get", :vendored_modules_path=>"C:/ProgramData/PuppetLabs/puppet/cache/lib/puppet_x/computermanagementdsc/dsc_resources", :attributes=>nil}
;36mDebug: dsc_timezone: Script:
 function new-pscredential {
    [CmdletBinding()]
    param (
        [parameter(Mandatory = $true,
            ValueFromPipelineByPropertyName = $true)]
        [string]
        $user,

        [parameter(Mandatory = $true,
            ValueFromPipelineByPropertyName = $true)]
        [string]
        $password
    )

    $secpasswd = ConvertTo-SecureString $password -AsPlainText -Force
    $credentials = New-Object System.Management.Automation.PSCredential ($user, $secpasswd)
    return $credentials
}

Function ConvertTo-CanonicalResult {
  [CmdletBinding()]
  param(
      [Parameter(Mandatory, Position = 1)]
      [psobject]
      $Result,

      [Parameter(DontShow)]
      [string]
      $PropertyPath,

      [Parameter(DontShow)]
      [int]
      $RecursionLevel = 0
  )

  $MaxDepth = 5
  $CimInstancePropertyFilter = { $_.Definition -match 'CimInstance' -and $_.Name -ne 'PSDscRunAsCredential' }

  # Get the properties which are/aren't Cim instances
  $ResultObject = @{ }
  $ResultPropertyList = $Result | Get-Member -MemberType Property | Where-Object { $_.Name -ne 'PSComputerName' }
  $CimInstanceProperties = $ResultPropertyList | Where-Object -FilterScript $CimInstancePropertyFilter

  foreach ($Property in $ResultPropertyList) {
      $PropertyName = $Property.Name
      if ($Property -notin $CimInstanceProperties) {
          $Value = $Result.$PropertyName
          if ($PropertyName -eq 'Ensure' -and [string]::IsNullOrEmpty($Result.$PropertyName)) {
              # Just set 'Present' since it was found /shrug
              # If the value IS listed as absent, don't update it unless you want flapping
              $Value = 'Present'
          }
          else {
              if ([string]::IsNullOrEmpty($value)) {
                  # While PowerShell can happily treat empty strings as valid for returning
                  # an undefined enum, Puppet expects undefined values to be nil.
                  $Value = $null
              }

              if ($Value.Count -eq 1 -and $Property.Definition -match '\\[\\]') {
                  $Value = @($Value)
              }
          }
      }
      elseif ($null -eq $Result.$PropertyName) {
          if ($Property -match 'InstanceArray') {
              $Value = @()
          }
          else {
              $Value = $null
          }
      }
      elseif ($Result.$PropertyName.GetType().Name -match 'DateTime') {
          # Handle DateTimes especially since they're an edge case
          $Value = Get-Date $Result.$PropertyName -UFormat "%Y-%m-%dT%H:%M:%S%Z"
      }
      else {
          # Looks like a nested CIM instance, recurse if we're not too deep in already.
          $RecursionLevel++

          if ($PropertyPath -eq [string]::Empty) {
              $PropertyPath = $PropertyName
          }
          else {
              $PropertyPath = "$PropertyPath.$PropertyName"
          }

          if ($RecursionLevel -gt $MaxDepth) {
              # Give up recursing more than this
              return $Result.ToString()
          }

          $Value = foreach ($item in $Result.$PropertyName) {
              ConvertTo-CanonicalResult -Result $item -PropertyPath $PropertyPath -RecursionLevel ($RecursionLevel + 1) -WarningAction Continue
          }

          # The cim instance type is the last component of the type Name
          # We need to return this for ruby to compare the result hashes
          # We do NOT need it for the top-level properties as those are defined in the type
          If ($RecursionLevel -gt 1 -and ![string]::IsNullOrEmpty($Value) ) {
              # If there's multiple instances, you need to add the type to each one, but you
              # need to specify only *one* name, otherwise things end up *very* broken.
              if ($Value.GetType().Name -match '\[\]') {
                  $Value | ForEach-Object -Process {
                      $_.cim_instance_type = $Result.$PropertyName.CimClass.CimClassName[0]
                  }
              } else {
                  $Value.cim_instance_type = $Result.$PropertyName.CimClass.CimClassName
                  # Ensure that, if it should be an array, it is
                  if ($Result.$PropertyName.GetType().Name -match '\[\]') {
                      $Value = @($Value)
                  }
              }
          }
      }

      if ($Property.Definition -match 'InstanceArray') {
          If ($null -eq $Value -or $Value.GetType().Name -notmatch '\[\]') { $Value = @($Value) }
      }

      $ResultObject.$PropertyName = $Value
  }

  # Output the final result
  $ResultObject
}
$script:ErrorActionPreference = 'Stop'
$script:WarningPreference = 'SilentlyContinue'

$response = @{
    indesiredstate = $false
    rebootrequired = $false
    errormessage   = ''
}

$UnmungedPSModulePath = [System.Environment]::GetEnvironmentVariable('PSModulePath','machine')
$MungedPSModulePath = $env:PSModulePath + ';C:\ProgramData\PuppetLabs\puppet\cache\lib\puppet_x\computermanagementdsc\dsc_resources'
[System.Environment]::SetEnvironmentVariable('PSModulePath', $MungedPSModulePath, [System.EnvironmentVariableTarget]::Machine)
$env:PSModulePath = [System.Environment]::GetEnvironmentVariable('PSModulePath','machine')

$InvokeParams = @{Name = 'TimeZone'; Method = 'get'; Property = @{issingleinstance = 'Yes'; timezone = 'Eastern Standard Time'}; ModuleName = @{ModuleName = 'ComputerManagementDsc'; RequiredVersion = '8.5.0'}}
Try {
  $Result = Invoke-DscResource @InvokeParams
} catch {
  $Response.errormessage   = $_.Exception.Message
  return ($Response | ConvertTo-Json -Compress)
} Finally {
  If (![string]::IsNullOrEmpty($UnmungedPSModulePath)) {
    # Reset the PSModulePath
    [System.Environment]::SetEnvironmentVariable('PSModulePath', $UnmungedPSModulePath, [System.EnvironmentVariableTarget]::Machine)
    $env:PSModulePath = [System.Environment]::GetEnvironmentVariable('PSModulePath', 'machine')
  }
}

# keep the switch for when Test passes back changed properties
Switch ($invokeParams.Method) {
  'Test' {
    $Response.indesiredstate = $Result.InDesiredState
    return ($Response | ConvertTo-Json -Compress)
  }
  'Set' {
    $Response.indesiredstate = $true
    $Response.rebootrequired = $Result.RebootRequired
    return ($Response | ConvertTo-Json -Compress)
  }
  'Get' {
    $CanonicalizedResult = ConvertTo-CanonicalResult -Result $Result
    return ($CanonicalizedResult | ConvertTo-Json -Compress -Depth 10)
  }
}

;36mDebug: dsc_timezone: raw data received: {"ResourceId"=>nil, "PsDscRunAsCredential"=>nil, "ModuleVersion"=>"8.5.0", "ConfigurationName"=>nil, "TimeZone"=>"Eastern Standard Time", "IsSingleInstance"=>"Yes", "ModuleName"=>"ComputerManagementDsc", "SourceInfo"=>nil, "DependsOn"=>nil}
;36mDebug: dsc_timezone: Returned to Puppet as {:dsc_issingleinstance=>"Yes", :dsc_timezone=>"Eastern Standard Time", :name=>"Windows_env['computername']_TimeZone"}
;36mDebug: dsc_timezone: Canonicalized Resources: [{:dsc_issingleinstance=>"Yes", :dsc_timezone=>"Eastern Standard Time", :name=>"Windows_env['computername']_TimeZone"}]
;36mDebug: Puppet::Type::Exec::ProviderPosix: feature posix is missing
;36mDebug: Puppet::Type::Exec::ProviderShell: feature posix is missing
;36mDebug: Puppet::Type::Archive::ProviderWget: file wget does not exist
;36mDebug: /Package[openjdk]: Provider chocolatey does not support features targetable; not managing attribute command
;36mDebug: /Package[openjdk]: Provider chocolatey does not support features install_only; not managing attribute install_only
;36mDebug: /Package[openjdk]: Provider chocolatey does not support features virtual_packages; not managing attribute allow_virtual
;36mDebug: dsc_sqlsetup: retrieving {:name=>"InstallDefaultInstance", :dsc_instancename=>"MSSQLSERVER", :dsc_features=>"SQLENGINE,FULLTEXT", :dsc_sapwd=>{"user"=>"sa", "password"=>nil}, :dsc_sqlcollation=>"SQL_Latin1_General_CP1_CI_AS", :dsc_sqlsysadminaccounts=>["REDACTED"], :dsc_sourcepath=>"S:\\", :dsc_securitymode=>"SQL", :dsc_sqlsvcstartuptype=>"Automatic", :dsc_agtsvcstartuptype=>"Automatic", :dsc_browsersvcstartuptype=>"Automatic", :require=>"Exec[sqlserver2022-mountiso]"}
;36mDebug: dsc_sqlsetup: invocable_resource: {:parameters=>{:dsc_instancename=>{:value=>"MSSQLSERVER", :mof_type=>"String", :mof_is_embedded=>false}, :dsc_sourcepath=>{:value=>"S:\\", :mof_type=>"String", :mof_is_embedded=>false}}, :name=>"dsc_sqlsetup", :dscmeta_resource_friendly_name=>"SqlSetup", :dscmeta_resource_name=>"DSC_SqlSetup", :dscmeta_resource_implementation=>"MOF", :dscmeta_module_name=>"SqlServerDsc", :dscmeta_module_version=>"16.0.0", :dsc_invoke_method=>"get", :vendored_modules_path=>"C:/ProgramData/PuppetLabs/puppet/cache/lib/puppet_x/sqlserverdsc/dsc_resources", :attributes=>nil}
;36mDebug: dsc_sqlsetup: Script:
 function new-pscredential {
    [CmdletBinding()]
    param (
        [parameter(Mandatory = $true,
            ValueFromPipelineByPropertyName = $true)]
        [string]
        $user,

        [parameter(Mandatory = $true,
            ValueFromPipelineByPropertyName = $true)]
        [string]
        $password
    )

    $secpasswd = ConvertTo-SecureString $password -AsPlainText -Force
    $credentials = New-Object System.Management.Automation.PSCredential ($user, $secpasswd)
    return $credentials
}

Function ConvertTo-CanonicalResult {
  [CmdletBinding()]
  param(
      [Parameter(Mandatory, Position = 1)]
      [psobject]
      $Result,

      [Parameter(DontShow)]
      [string]
      $PropertyPath,

      [Parameter(DontShow)]
      [int]
      $RecursionLevel = 0
  )

  $MaxDepth = 5
  $CimInstancePropertyFilter = { $_.Definition -match 'CimInstance' -and $_.Name -ne 'PSDscRunAsCredential' }

  # Get the properties which are/aren't Cim instances
  $ResultObject = @{ }
  $ResultPropertyList = $Result | Get-Member -MemberType Property | Where-Object { $_.Name -ne 'PSComputerName' }
  $CimInstanceProperties = $ResultPropertyList | Where-Object -FilterScript $CimInstancePropertyFilter

  foreach ($Property in $ResultPropertyList) {
      $PropertyName = $Property.Name
      if ($Property -notin $CimInstanceProperties) {
          $Value = $Result.$PropertyName
          if ($PropertyName -eq 'Ensure' -and [string]::IsNullOrEmpty($Result.$PropertyName)) {
              # Just set 'Present' since it was found /shrug
              # If the value IS listed as absent, don't update it unless you want flapping
              $Value = 'Present'
          }
          else {
              if ([string]::IsNullOrEmpty($value)) {
                  # While PowerShell can happily treat empty strings as valid for returning
                  # an undefined enum, Puppet expects undefined values to be nil.
                  $Value = $null
              }

              if ($Value.Count -eq 1 -and $Property.Definition -match '\\[\\]') {
                  $Value = @($Value)
              }
          }
      }
      elseif ($null -eq $Result.$PropertyName) {
          if ($Property -match 'InstanceArray') {
              $Value = @()
          }
          else {
              $Value = $null
          }
      }
      elseif ($Result.$PropertyName.GetType().Name -match 'DateTime') {
          # Handle DateTimes especially since they're an edge case
          $Value = Get-Date $Result.$PropertyName -UFormat "%Y-%m-%dT%H:%M:%S%Z"
      }
      else {
          # Looks like a nested CIM instance, recurse if we're not too deep in already.
          $RecursionLevel++

          if ($PropertyPath -eq [string]::Empty) {
              $PropertyPath = $PropertyName
          }
          else {
              $PropertyPath = "$PropertyPath.$PropertyName"
          }

          if ($RecursionLevel -gt $MaxDepth) {
              # Give up recursing more than this
              return $Result.ToString()
          }

          $Value = foreach ($item in $Result.$PropertyName) {
              ConvertTo-CanonicalResult -Result $item -PropertyPath $PropertyPath -RecursionLevel ($RecursionLevel + 1) -WarningAction Continue
          }

          # The cim instance type is the last component of the type Name
          # We need to return this for ruby to compare the result hashes
          # We do NOT need it for the top-level properties as those are defined in the type
          If ($RecursionLevel -gt 1 -and ![string]::IsNullOrEmpty($Value) ) {
              # If there's multiple instances, you need to add the type to each one, but you
              # need to specify only *one* name, otherwise things end up *very* broken.
              if ($Value.GetType().Name -match '\[\]') {
                  $Value | ForEach-Object -Process {
                      $_.cim_instance_type = $Result.$PropertyName.CimClass.CimClassName[0]
                  }
              } else {
                  $Value.cim_instance_type = $Result.$PropertyName.CimClass.CimClassName
                  # Ensure that, if it should be an array, it is
                  if ($Result.$PropertyName.GetType().Name -match '\[\]') {
                      $Value = @($Value)
                  }
              }
          }
      }

      if ($Property.Definition -match 'InstanceArray') {
          If ($null -eq $Value -or $Value.GetType().Name -notmatch '\[\]') { $Value = @($Value) }
      }

      $ResultObject.$PropertyName = $Value
  }

  # Output the final result
  $ResultObject
}
$script:ErrorActionPreference = 'Stop'
$script:WarningPreference = 'SilentlyContinue'

$response = @{
    indesiredstate = $false
    rebootrequired = $false
    errormessage   = ''
}

$InvokeParams = @{Name = 'SqlSetup'; Method = 'get'; Property = @{instancename = 'MSSQLSERVER'; sourcepath = 'S:\'}; ModuleName = @{ModuleName = 'C:/ProgramData/PuppetLabs/puppet/cache/lib/puppet_x/sqlserverdsc/dsc_resources/SqlServerDsc/SqlServerDsc.psd1'; RequiredVersion = '16.0.0'}}
Try {
  $Result = Invoke-DscResource @InvokeParams
} catch {
  $Response.errormessage   = $_.Exception.Message
  return ($Response | ConvertTo-Json -Compress)
} Finally {
  If (![string]::IsNullOrEmpty($UnmungedPSModulePath)) {
    # Reset the PSModulePath
    [System.Environment]::SetEnvironmentVariable('PSModulePath', $UnmungedPSModulePath, [System.EnvironmentVariableTarget]::Machine)
    $env:PSModulePath = [System.Environment]::GetEnvironmentVariable('PSModulePath', 'machine')
  }
}

# keep the switch for when Test passes back changed properties
Switch ($invokeParams.Method) {
  'Test' {
    $Response.indesiredstate = $Result.InDesiredState
    return ($Response | ConvertTo-Json -Compress)
  }
  'Set' {
    $Response.indesiredstate = $true
    $Response.rebootrequired = $Result.RebootRequired
    return ($Response | ConvertTo-Json -Compress)
  }
  'Get' {
    $CanonicalizedResult = ConvertTo-CanonicalResult -Result $Result
    return ($CanonicalizedResult | ConvertTo-Json -Compress -Depth 10)
  }
}

;36mDebug: dsc_sqlsetup: raw data received: {"rebootrequired"=>false, "indesiredstate"=>false, "errormessage"=>"Cannot find drive. A drive with the name 'S' does not exist."}
;36mDebug: dsc_sqlsetup: Canonicalized Resources: [{:name=>"InstallDefaultInstance", :dsc_instancename=>"MSSQLSERVER", :dsc_features=>"SQLENGINE,FULLTEXT", :dsc_sapwd=>{"user"=>"sa", "password"=>nil}, :dsc_sqlcollation=>"SQL_Latin1_General_CP1_CI_AS", :dsc_sqlsysadminaccounts=>[REDACTED], :dsc_sourcepath=>"S:\\", :dsc_securitymode=>"SQL", :dsc_sqlsvcstartuptype=>"Automatic", :dsc_agtsvcstartuptype=>"Automatic", :dsc_browsersvcstartuptype=>"Automatic", :require=>"Exec[sqlserver2022-mountiso]"}]
;36mDebug: Resolving service 'report' using Puppet::HTTP::Resolver::Settings
;36mDebug: Closing connection for https://puppet:8140
;36mDebug: Creating new connection for https://puppet:8140
;36mDebug: Starting connection for https://puppet:8140
;36mDebug: Using TLSv1.2 with cipher DHE-RSA-AES128-GCM-SHA256
;36mDebug: Caching connection for https://puppet:8140
;36mDebug: Resolved service 'report' to https://puppet:8140/puppet/v3
;36mDebug: Puppet::Network::Format[msgpack]: feature msgpack is missing
;36mDebug: Puppet::Network::Format[rich_data_msgpack]: feature msgpack is missing
;36mDebug: report supports formats: json pson yaml
;36mDebug: Using cached connection for https://puppet:8140
;36mDebug: HTTP PUT https://puppet:8140/puppet/v3/report/mymachine?environment=production returned 200 OK
;36mDebug: Caching connection for https://puppet:8140
;36mDebug: Closing connection for https://puppet:8140

DSC configuration

Using puppet dsc modules

Suggested solution

Evaluation of sourcepath should not happen until the sqlsetup resource is run.

SQL Server edition and version

SQL Server 2022 Enterprise Edition

SQL Server PowerShell modules

AzureRM.Sql 4.2.0   C:\Program Files\WindowsPowerShell\Modules\AzureRM.Sql\4.2.0\AzureRM.Sql.psd1

Operating system

Windows Server 2022 Datacenter

PowerShell version

PSVersion                      5.1.20348.1366
PSEdition                      Desktop
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0...}
BuildVersion                   10.0.20348.1366
CLRVersion                     4.0.30319.42000
WSManStackVersion              3.0
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1

SqlServerDsc version

N/a, using puppet
johlju commented 1 year ago

If "loading facts" stage runs the method Get on all DSC resources then the media must be available at that point since the version of the media (the version of setup.exe) is used to determine the version that is gonna be installed (media must be available for all methods, Get, Test, and Set).

johlju commented 1 year ago

Is it possible to tell Puppet not to evaluate SqlSetup until runtime?

johlju commented 1 year ago

my first step is to copy the iso from a corporate file share and extract it

Another option is let SqlSetup do this copy by adding SourceCredential. Then it will mount a share that SourcePath points at and get the version from sqlsetup.exe on that path (it must be already extracted at source). When method Set run it will mount the share and copy the content of the SourcePath to a temporary local path, and install from that local path.

unkinected commented 1 year ago

Is it possible to tell Puppet not to evaluate SqlSetup until runtime?

I thought I had done all that by trying dependencies, virtual resources, and run stages, but if there's a way to delay Puppet calling Get-TargetResource until later, I'm not sure.

I took a look at the source code for sqlsetup and tried playing around by adding an optional "SqlVersion" parameter that would obviate the need for SourcePath during Get-TargetResource. I got too far in the weeds and decided to go another route.

It looks like the SourceCredential option wouldn't work for me... the "corporate file share" I mentioned is actually in an Azure storage file share, which is not as easily accessible, so the steps to download the ISO and extract it require more work than sqlsetup can handle.

I've worked around this for now by simply requiring our team to download and extract the ISO before applying the sqlsetup module. This two step process is less than ideal, but at least it gets me to the end goal.

johlju commented 1 year ago

I took a look at the source code for sqlsetup and tried playing around by adding an optional "SqlVersion" parameter

That was a thought I had too when I read this issue. I think it would be easy enough to just set $sqlVersion to a parameter SqlVersion instead of running these two lines.

https://github.com/dsccommunity/SqlServerDsc/blob/527dcd4e444bd5e799bb6cd415a08d420246d99a/source/DSCResources/DSC_SqlSetup/DSC_SqlSetup.psm1#L195

https://github.com/dsccommunity/SqlServerDsc/blob/527dcd4e444bd5e799bb6cd415a08d420246d99a/source/DSCResources/DSC_SqlSetup/DSC_SqlSetup.psm1#L1015

Since it would be optional it wouldn't break anything else.

johlju commented 1 year ago

@unkinected I pushed this change in 16.5.0-preview0001 - try it and report back if there are any issues.