1

我正在尝试在 Windows 本地机器上编写/测试一个 puppet 清单,该机器执行一个可执行文件的安静安装。因为我只在一台机器上测试,所以我只使用 puppet apply。这是我的木偶文件:

class particularnsbservice{

$pkg = 'Particular.NServiceBus-4.0.2.exe'

file { $pkg:
  ensure => present,
  name   => "C:\\Temp\\${pkg}",
  source => "puppet:///puppetfs/${pkg}",
  mode   => '0755',
  before => Exec['install_nsbus'],
}

exec { 'install_nsbus':
  command   => "C:\\Temp\\${pkg} /q /l C:\\Temp\\${pkg}.log",
  creates   => 'C:\Program Files (x86)\ParticularNSBServicecular.NServiceBus\bin',
  logoutput => true,
  }
}

这些是我应用清单后生成的日志:

Wed Sep 11 11:32:54 -0400 2013 Puppet (info): Loading facts in C:/ProgramData/PuppetLabs/puppet/etc/modules/admin/lib/facter/user_name.rb
Wed Sep 11 11:32:54 -0400 2013 Puppet (info): Loading facts in C:/ProgramData/PuppetLabs/puppet/etc/modules/teamcityagent/lib/facter/short_host.rb
Wed Sep 11 11:32:54 -0400 2013 Puppet (info): Loading facts in C:/ProgramData/PuppetLabs/puppet/var/lib/facter/concat_basedir.rb
Wed Sep 11 11:32:54 -0400 2013 Puppet (info): Loading facts in C:/ProgramData/PuppetLabs/puppet/var/lib/facter/custom_auth_conf.rb
Wed Sep 11 11:32:54 -0400 2013 Puppet (info): Loading facts in C:/ProgramData/PuppetLabs/puppet/var/lib/facter/facter_dot_d.rb
Wed Sep 11 11:32:54 -0400 2013 Puppet (info): Loading facts in C:/ProgramData/PuppetLabs/puppet/var/lib/facter/pe_version.rb
Wed Sep 11 11:32:54 -0400 2013 Puppet (info): Loading facts in C:/ProgramData/PuppetLabs/puppet/var/lib/facter/puppet_vardir.rb
Wed Sep 11 11:32:54 -0400 2013 Puppet (info): Loading facts in C:/ProgramData/PuppetLabs/puppet/var/lib/facter/root_home.rb
Wed Sep 11 11:32:54 -0400 2013 Puppet (info): Loading facts in C:/ProgramData/PuppetLabs/puppet/var/lib/facter/user_name.rb
Wed Sep 11 11:33:02 -0400 2013 Puppet (debug): Creating default schedules
Wed Sep 11 11:33:02 -0400 2013 Puppet (debug): Finishing transaction 131507484
Wed Sep 11 11:33:02 -0400 2013 Puppet (debug): Failed to load library 'selinux' for feature 'selinux'
Wed Sep 11 11:33:02 -0400 2013 Puppet (debug): Puppet::Type::File::ProviderPosix: feature posix is missing
Wed Sep 11 11:33:03 -0400 2013 Puppet (debug): Failed to load library 'shadow' for feature 'libshadow'
Wed Sep 11 11:33:03 -0400 2013 /File[C:/ProgramData/PuppetLabs/puppet/var/clientbucket] (debug): Autorequiring File[C:/ProgramData/PuppetLabs/puppet/var]
Wed Sep 11 11:33:03 -0400 2013 /File[C:/ProgramData/PuppetLabs/puppet/var/log] (debug): Autorequiring File[C:/ProgramData/PuppetLabs/puppet/var]
Wed Sep 11 11:33:03 -0400 2013 /File[C:/ProgramData/PuppetLabs/puppet/var/facts] (debug): Autorequiring File[C:/ProgramData/PuppetLabs/puppet/var]
Wed Sep 11 11:33:03 -0400 2013 /File[C:/ProgramData/PuppetLabs/puppet/etc/ssl/certs/lt70121.va.nreca.org.pem] (debug): Autorequiring File[C:/ProgramData/PuppetLabs/puppet/etc/ssl/certs]
Wed Sep 11 11:33:03 -0400 2013 /File[C:/ProgramData/PuppetLabs/puppet/var/lib] (debug): Autorequiring File[C:/ProgramData/PuppetLabs/puppet/var]
Wed Sep 11 11:33:03 -0400 2013 /File[C:/ProgramData/PuppetLabs/puppet/var/state/classes.txt] (debug): Autorequiring File[C:/ProgramData/PuppetLabs/puppet/var/state]
Wed Sep 11 11:33:03 -0400 2013 /File[C:/ProgramData/PuppetLabs/puppet/etc/ssl/certs] (debug): Autorequiring File[C:/ProgramData/PuppetLabs/puppet/etc/ssl]
Wed Sep 11 11:33:03 -0400 2013 /File[C:/ProgramData/PuppetLabs/puppet/var/state/graphs] (debug): Autorequiring File[C:/ProgramData/PuppetLabs/puppet/var/state]
Wed Sep 11 11:33:03 -0400 2013 /File[C:/ProgramData/PuppetLabs/puppet/var/state/state.yaml] (debug): Autorequiring File[C:/ProgramData/PuppetLabs/puppet/var/state]
Wed Sep 11 11:33:03 -0400 2013 /File[C:/ProgramData/PuppetLabs/puppet/var/state] (debug): Autorequiring File[C:/ProgramData/PuppetLabs/puppet/var]
Wed Sep 11 11:33:03 -0400 2013 /File[C:/ProgramData/PuppetLabs/puppet/var/run] (debug): Autorequiring File[C:/ProgramData/PuppetLabs/puppet/var]
Wed Sep 11 11:33:03 -0400 2013 /File[C:/ProgramData/PuppetLabs/puppet/etc/ssl/public_keys/lt70121.va.nreca.org.pem] (debug): Autorequiring File[C:/ProgramData/PuppetLabs/puppet/etc/ssl/public_keys]
Wed Sep 11 11:33:03 -0400 2013 /File[C:/ProgramData/PuppetLabs/puppet/etc/ssl/crl.pem] (debug): Autorequiring File[C:/ProgramData/PuppetLabs/puppet/etc/ssl]
Wed Sep 11 11:33:03 -0400 2013 /File[C:/ProgramData/PuppetLabs/puppet/etc/ssl/certificate_requests] (debug): Autorequiring File[C:/ProgramData/PuppetLabs/puppet/etc/ssl]
Wed Sep 11 11:33:03 -0400 2013 /File[C:/ProgramData/PuppetLabs/puppet/var/state/resources.txt] (debug): Autorequiring File[C:/ProgramData/PuppetLabs/puppet/var/state]
Wed Sep 11 11:33:03 -0400 2013 /File[C:/ProgramData/PuppetLabs/puppet/etc/ssl/public_keys] (debug): Autorequiring File[C:/ProgramData/PuppetLabs/puppet/etc/ssl]
Wed Sep 11 11:33:03 -0400 2013 /File[C:/ProgramData/PuppetLabs/puppet/etc/ssl/private] (debug): Autorequiring File[C:/ProgramData/PuppetLabs/puppet/etc/ssl]
Wed Sep 11 11:33:03 -0400 2013 /File[C:/ProgramData/PuppetLabs/puppet/etc/ssl/certs/ca.pem] (debug): Autorequiring File[C:/ProgramData/PuppetLabs/puppet/etc/ssl/certs]
Wed Sep 11 11:33:03 -0400 2013 /File[C:/ProgramData/PuppetLabs/puppet/etc/ssl/private_keys/lt70121.va.nreca.org.pem] (debug): Autorequiring File[C:/ProgramData/PuppetLabs/puppet/etc/ssl/private_keys]
Wed Sep 11 11:33:03 -0400 2013 /File[C:/ProgramData/PuppetLabs/puppet/var/state/last_run_report.yaml] (debug): Autorequiring File[C:/ProgramData/PuppetLabs/puppet/var/state]
Wed Sep 11 11:33:03 -0400 2013 /File[C:/ProgramData/PuppetLabs/puppet/etc/ssl/private_keys] (debug): Autorequiring File[C:/ProgramData/PuppetLabs/puppet/etc/ssl]
Wed Sep 11 11:33:03 -0400 2013 /File[C:/ProgramData/PuppetLabs/puppet/var/client_data] (debug): Autorequiring File[C:/ProgramData/PuppetLabs/puppet/var]
Wed Sep 11 11:33:03 -0400 2013 /File[C:/ProgramData/PuppetLabs/puppet/var/state/last_run_summary.yaml] (debug): Autorequiring File[C:/ProgramData/PuppetLabs/puppet/var/state]
Wed Sep 11 11:33:03 -0400 2013 /File[C:/ProgramData/PuppetLabs/puppet/etc/ssl] (debug): Autorequiring File[C:/ProgramData/PuppetLabs/puppet/etc]
Wed Sep 11 11:33:03 -0400 2013 /File[C:/ProgramData/PuppetLabs/puppet/var/client_yaml] (debug): Autorequiring File[C:/ProgramData/PuppetLabs/puppet/var]
Wed Sep 11 11:33:03 -0400 2013 Puppet (debug): Finishing transaction 39997452
Wed Sep 11 11:33:03 -0400 2013 Puppet (debug): Loaded state in 0.02 seconds
Wed Sep 11 11:33:03 -0400 2013 Puppet (debug): Loaded state in 0.01 seconds
Wed Sep 11 11:33:03 -0400 2013 Puppet (info): Applying configuration version '1378913582'
Wed Sep 11 11:33:03 -0400 2013 /Schedule[daily] (debug): Skipping device resources because running on a host
Wed Sep 11 11:33:03 -0400 2013 /Schedule[monthly] (debug): Skipping device resources because running on a host
Wed Sep 11 11:33:03 -0400 2013 /Schedule[hourly] (debug): Skipping device resources because running on a host
Wed Sep 11 11:33:03 -0400 2013 /Schedule[never] (debug): Skipping device resources because running on a host
Wed Sep 11 11:33:03 -0400 2013 /Schedule[weekly] (debug): Skipping device resources because running on a host
Wed Sep 11 11:33:03 -0400 2013 /Schedule[puppet] (debug): Skipping device resources because running on a host
Wed Sep 11 11:33:03 -0400 2013 Puppet (debug): Finishing transaction 40823628
Wed Sep 11 11:33:03 -0400 2013 Puppet (debug): Storing state
Wed Sep 11 11:33:03 -0400 2013 Puppet (debug): Stored state in 0.04 seconds
Wed Sep 11 11:33:03 -0400 2013 Puppet (notice): Finished catalog run in 0.15 seconds
Wed Sep 11 11:33:03 -0400 2013 Puppet (debug): Finishing transaction 39987792
Wed Sep 11 11:33:03 -0400 2013 Puppet (debug): Received report to process from [server name redacted]
Wed Sep 11 11:33:03 -0400 2013 Puppet (debug): Processing report from [server name redacted] with processor Puppet::Reports::Store

在申请结束时,我收到此错误消息:

Could not retrieve short_host: undefined method `[]' for nil:NilClass

我做了一些研究,这个错误通常是指课堂上某个地方的书面错误,但是 puppet parser validate 和 rake lint 在我的清单中都没有发现错误。那么这里的错误可能是什么?

提前致谢!

4

1 回答 1

0

我很久以前写过这个清单,但从那时起我将其更改为以下内容,并且以下代码适用于 Puppet 3.2.3:

class nsb ($version = '4.0.2') {

  $pkg = "Particular.NServiceBus-${version}"

  package { $pkg:
  ensure           => installed,
  name             => "Particular Software NServiceBus v${version}",
  source           => "${shared_drive}\\nsb\\${pkg}.exe",
  install_options  => [ '/q', '/l', 'C:\Temp\nsbinstall.log' ]
  }
}
于 2014-06-25T14:50:17.640 回答