Issue #14674 has been updated by Alex Harvey.
This code will also break on HP-UX, because HP-UX also has an lsdev command,
and the HP-UX lsdev will fail when called with AIX-specific options in
util/processor.rb.
<pre>
# uname -a
HP-UX myhost B.11.23 U ia64 0573364837 unlimited-user license
# facter -d processorcount
Found no suitable resolves of 6 for macaddress
value for macaddress is still nil
Found no suitable resolves of 6 for macaddress
value for macaddress is still nil
Not an EC2 host
processor - invalid major number
usage: lsdev [-h] [-d driver | -C class] [-b block_major] [-c char_major]
[-e major] [major] ...
Found no suitable resolves of 7 for processorcount
value for processorcount is still nil
#
</pre>
----------------------------------------
Bug #14674: Facter processor fact executes commands on platforms that it
shouldn't
https://projects.puppetlabs.com/issues/14674#change-70772
Author: Josh Cooper
Status: Accepted
Priority: Normal
Assignee:
Category: library
Target version:
Keywords:
Branch:
Affected Facter version:
When evaluating the processor fact, it calls the following on all platforms:
<pre>
## We have to enumerate these outside a Facter.add block to get the processorN
descriptions iteratively
## (but we need them inside the Facter.add block above for tests on
processorcount to work)
processor_list = Facter::Util::Processor.enum_cpuinfo
processor_list_aix = Facter::Util::Processor.enum_lsdev
processor_list_sunos = Facter::Util::Processor.enum_kstat
</pre>
It should only call these methods on the appropriate platform, and it should
only call them when needed (if processor_list is empty).
This is causing build failures when running Windows specific processor spec
test on a Linux host. Because although we stub the kernel fact, the processor
fact sees that /proc/cpuinfo exists, and tries to load the architecture fact,
which tries to load the hardwaremodel fact, which on Windows was recently
changed to use WMI instead of using RbConfig.
This appears to be new behavior as a result of
<https://github.com/puppetlabs/facter/commit/328ff7584e0353a609cba6d9fa08c0b6a26be664>,
which used to conditionally execute the commands depending on the value of the
kernel fact.
This is the build failure:
<pre>
1) Processor facts on Windows 2003 should count 2 processors
Failure/Error: Facter.collection.loader.load(:processor)
Mocha::ExpectationError:
unexpected invocation: Facter::Util::WMI.execquery('select Architecture,
Level from Win32_Processor')
satisfied expectations:
- allowed any number of times, not yet invoked:
#<AnyInstance:Facter::Util::Loader>.load_all(any_parameters)
- allowed any number of times, invoked 7 times:
#<Facter::Util::Fact:0x7fa9282f4cb0>.value(any_parameters)
- allowed any number of times, not yet invoked:
#<RSpec::Core::ExampleGroup::Nested_44::Nested_1::Nested_1:0x7fa9282fb650>.proc(any_parameters)
- allowed any number of times, not yet invoked: allowed any number of
times, not yet invoked:
#<RSpec::Core::ExampleGroup::Nested_44::Nested_1::Nested_1:0x7fa9282fb650>.proc(any_parameters).Name(any_parameters)
- allowed any number of times, not yet invoked: allowed any number of
times, not yet invoked:
#<RSpec::Core::ExampleGroup::Nested_44::Nested_1::Nested_1:0x7fa9282fb650>.proc(any_parameters).NumberOfLogicalProcessors(any_parameters)
- allowed any number of times, not yet invoked:
Facter::Util::WMI.execquery('select * from Win32_Processor')
# ./spec/../lib/facter/hardwaremodel.rb:39
# ./spec/../lib/facter/util/resolution.rb:162:in `call'
# ./spec/../lib/facter/util/resolution.rb:162:in `value'
# ./spec/../lib/facter/util/resolution.rb:160:in `value'
# ./spec/../lib/facter/util/fact.rb:78:in `value'
# ./spec/../lib/facter/util/loader.rb:81:in `inject'
# ./spec/../lib/facter/util/fact.rb:74:in `each'
# ./spec/../lib/facter/util/fact.rb:74:in `inject'
# ./spec/../lib/facter/util/fact.rb:74:in `value'
# ./spec/../lib/facter/util/fact.rb:120:in `searching'
# ./spec/../lib/facter/util/fact.rb:70:in `value'
# ./spec/../lib/facter/util/collection.rb:118:in `value'
# ./spec/../lib/facter.rb:98:in `send'
# ./spec/../lib/facter.rb:98:in `value'
# ./spec/../lib/facter/architecture.rb:16
# ./spec/../lib/facter/util/resolution.rb:162:in `call'
# ./spec/../lib/facter/util/resolution.rb:162:in `value'
# ./spec/../lib/facter/util/resolution.rb:160:in `value'
# ./spec/../lib/facter/util/fact.rb:78:in `value'
# ./spec/../lib/facter/util/loader.rb:81:in `inject'
# ./spec/../lib/facter/util/fact.rb:74:in `each'
# ./spec/../lib/facter/util/fact.rb:74:in `inject'
# ./spec/../lib/facter/util/fact.rb:74:in `value'
# ./spec/../lib/facter/util/fact.rb:120:in `searching'
# ./spec/../lib/facter/util/fact.rb:70:in `value'
# ./spec/../lib/facter/util/collection.rb:118:in `value'
# ./spec/../lib/facter.rb:98:in `send'
# ./spec/../lib/facter.rb:98:in `value'
# ./spec/../lib/facter/util/processor.rb:8:in `enum_cpuinfo'
# ./spec/../lib/facter/processor.rb:83
# ./spec/../lib/facter/util/loader.rb:81:in `load'
# ./spec/../lib/facter/util/loader.rb:81:in `load_file'
# ./spec/../lib/facter/util/loader.rb:21:in `load'
# ./spec/../lib/facter/util/loader.rb:17:in `each'
# ./spec/../lib/facter/util/loader.rb:17:in `load'
# ./spec/unit/processor_spec.rb:23:in `load'
# ./spec/unit/processor_spec.rb:32
--
You have received this notification because you have either subscribed to it,
or are involved in it.
To change your notification preferences, please click here:
http://projects.puppetlabs.com/my/account
--
You received this message because you are subscribed to the Google Groups
"Puppet Bugs" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/puppet-bugs?hl=en.