facter 2.1.0-x64-mingw32
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of facter might be problematic. Click here for more details.
- checksums.yaml +7 -0
- data/COMMITTERS.md +194 -0
- data/CONTRIBUTING.md +65 -0
- data/Gemfile +53 -0
- data/LICENSE +15 -0
- data/README.md +33 -0
- data/Rakefile +79 -0
- data/bin/facter +20 -0
- data/etc/facter.conf +5 -0
- data/ext/build_defaults.yaml +24 -0
- data/ext/debian/changelog.erb +59 -0
- data/ext/debian/compat +1 -0
- data/ext/debian/control +14 -0
- data/ext/debian/copyright +19 -0
- data/ext/debian/docs +1 -0
- data/ext/debian/lintian-overrides +0 -0
- data/ext/debian/rules +10 -0
- data/ext/debian/source/format +1 -0
- data/ext/facter-diff +74 -0
- data/ext/ips/facter.p5m.erb +10 -0
- data/ext/ips/rules +7 -0
- data/ext/ips/transforms +18 -0
- data/ext/osx/file_mapping.yaml +27 -0
- data/ext/osx/preflight.erb +33 -0
- data/ext/osx/prototype.plist.erb +38 -0
- data/ext/project_data.yaml +36 -0
- data/ext/redhat/facter.spec.erb +220 -0
- data/ext/solaris/pkginfo +7 -0
- data/install.rb +380 -0
- data/lib/facter.rb +261 -0
- data/lib/facter/Cfkey.rb +42 -0
- data/lib/facter/application.rb +204 -0
- data/lib/facter/architecture.rb +50 -0
- data/lib/facter/augeasversion.rb +28 -0
- data/lib/facter/blockdevices.rb +105 -0
- data/lib/facter/core/aggregate.rb +220 -0
- data/lib/facter/core/directed_graph.rb +46 -0
- data/lib/facter/core/execution.rb +123 -0
- data/lib/facter/core/execution/base.rb +81 -0
- data/lib/facter/core/execution/posix.rb +50 -0
- data/lib/facter/core/execution/windows.rb +57 -0
- data/lib/facter/core/logging.rb +169 -0
- data/lib/facter/core/resolvable.rb +94 -0
- data/lib/facter/core/suitable.rb +113 -0
- data/lib/facter/dhcp_servers.rb +39 -0
- data/lib/facter/domain.rb +99 -0
- data/lib/facter/ec2.rb +44 -0
- data/lib/facter/ec2/rest.rb +130 -0
- data/lib/facter/facterversion.rb +15 -0
- data/lib/facter/filesystems.rb +38 -0
- data/lib/facter/fqdn.rb +24 -0
- data/lib/facter/gce.rb +16 -0
- data/lib/facter/gce/metadata.rb +87 -0
- data/lib/facter/hardwareisa.rb +20 -0
- data/lib/facter/hardwaremodel.rb +67 -0
- data/lib/facter/hostname.rb +31 -0
- data/lib/facter/id.rb +21 -0
- data/lib/facter/interfaces.rb +46 -0
- data/lib/facter/ipaddress.rb +171 -0
- data/lib/facter/ipaddress6.rb +82 -0
- data/lib/facter/iphostnumber.rb +29 -0
- data/lib/facter/kernel.rb +22 -0
- data/lib/facter/kernelmajversion.rb +23 -0
- data/lib/facter/kernelrelease.rb +50 -0
- data/lib/facter/kernelversion.rb +22 -0
- data/lib/facter/ldom.rb +47 -0
- data/lib/facter/lsbdistcodename.rb +16 -0
- data/lib/facter/lsbdistdescription.rb +25 -0
- data/lib/facter/lsbdistid.rb +16 -0
- data/lib/facter/lsbdistrelease.rb +16 -0
- data/lib/facter/lsbmajdistrelease.rb +27 -0
- data/lib/facter/lsbrelease.rb +16 -0
- data/lib/facter/macaddress.rb +97 -0
- data/lib/facter/macosx.rb +56 -0
- data/lib/facter/manufacturer.rb +68 -0
- data/lib/facter/memory.rb +168 -0
- data/lib/facter/netmask.rb +42 -0
- data/lib/facter/network.rb +20 -0
- data/lib/facter/operatingsystem.rb +141 -0
- data/lib/facter/operatingsystemmajrelease.rb +47 -0
- data/lib/facter/operatingsystemrelease.rb +250 -0
- data/lib/facter/osfamily.rb +37 -0
- data/lib/facter/partitions.rb +35 -0
- data/lib/facter/path.rb +14 -0
- data/lib/facter/physicalprocessorcount.rb +91 -0
- data/lib/facter/processor.rb +168 -0
- data/lib/facter/ps.rb +30 -0
- data/lib/facter/puppetversion.rb +20 -0
- data/lib/facter/rubysitedir.rb +12 -0
- data/lib/facter/rubyversion.rb +12 -0
- data/lib/facter/selinux.rb +99 -0
- data/lib/facter/ssh.rb +72 -0
- data/lib/facter/timezone.rb +14 -0
- data/lib/facter/uniqueid.rb +4 -0
- data/lib/facter/uptime.rb +34 -0
- data/lib/facter/uptime_days.rb +15 -0
- data/lib/facter/uptime_hours.rb +15 -0
- data/lib/facter/uptime_seconds.rb +24 -0
- data/lib/facter/util/architecture.rb +19 -0
- data/lib/facter/util/collection.rb +161 -0
- data/lib/facter/util/composite_loader.rb +12 -0
- data/lib/facter/util/config.rb +63 -0
- data/lib/facter/util/confine.rb +66 -0
- data/lib/facter/util/dhcp_servers.rb +43 -0
- data/lib/facter/util/directory_loader.rb +83 -0
- data/lib/facter/util/ec2.rb +106 -0
- data/lib/facter/util/fact.rb +204 -0
- data/lib/facter/util/file_read.rb +37 -0
- data/lib/facter/util/formatter.rb +39 -0
- data/lib/facter/util/ip.rb +285 -0
- data/lib/facter/util/ip/windows.rb +215 -0
- data/lib/facter/util/loader.rb +155 -0
- data/lib/facter/util/macaddress.rb +43 -0
- data/lib/facter/util/macosx.rb +73 -0
- data/lib/facter/util/manufacturer.rb +99 -0
- data/lib/facter/util/memory.rb +228 -0
- data/lib/facter/util/netmask.rb +40 -0
- data/lib/facter/util/normalization.rb +94 -0
- data/lib/facter/util/nothing_loader.rb +12 -0
- data/lib/facter/util/operatingsystem.rb +21 -0
- data/lib/facter/util/parser.rb +158 -0
- data/lib/facter/util/partitions.rb +41 -0
- data/lib/facter/util/partitions/linux.rb +65 -0
- data/lib/facter/util/plist.rb +24 -0
- data/lib/facter/util/plist/generator.rb +228 -0
- data/lib/facter/util/plist/parser.rb +226 -0
- data/lib/facter/util/posix.rb +16 -0
- data/lib/facter/util/processor.rb +289 -0
- data/lib/facter/util/registry.rb +11 -0
- data/lib/facter/util/resolution.rb +160 -0
- data/lib/facter/util/solaris_zones.rb +158 -0
- data/lib/facter/util/unix_root.rb +5 -0
- data/lib/facter/util/uptime.rb +81 -0
- data/lib/facter/util/values.rb +109 -0
- data/lib/facter/util/virtual.rb +180 -0
- data/lib/facter/util/vlans.rb +21 -0
- data/lib/facter/util/windows_root.rb +7 -0
- data/lib/facter/util/wmi.rb +16 -0
- data/lib/facter/util/xendomains.rb +10 -0
- data/lib/facter/version.rb +86 -0
- data/lib/facter/virtual.rb +311 -0
- data/lib/facter/vlans.rb +17 -0
- data/lib/facter/xendomains.rb +20 -0
- data/lib/facter/zfs_version.rb +10 -0
- data/lib/facter/zonename.rb +6 -0
- data/lib/facter/zones.rb +17 -0
- data/lib/facter/zpool_version.rb +10 -0
- data/spec/fixtures/cpuinfo/amd64dual +57 -0
- data/spec/fixtures/cpuinfo/amd64quad +79 -0
- data/spec/fixtures/cpuinfo/amd64solo +23 -0
- data/spec/fixtures/cpuinfo/amd64tri +86 -0
- data/spec/fixtures/cpuinfo/amd64twentyfour +600 -0
- data/spec/fixtures/cpuinfo/bbg3-armel +12 -0
- data/spec/fixtures/cpuinfo/beaglexm-armel +12 -0
- data/spec/fixtures/cpuinfo/panda-armel +17 -0
- data/spec/fixtures/cpuinfo/ppc64 +19 -0
- data/spec/fixtures/cpuinfo/sparc +10 -0
- data/spec/fixtures/hpux/machinfo/hppa-rp4440 +26 -0
- data/spec/fixtures/hpux/machinfo/ia64-rx2620 +49 -0
- data/spec/fixtures/hpux/machinfo/ia64-rx6600 +26 -0
- data/spec/fixtures/hpux/machinfo/ia64-rx8640 +53 -0
- data/spec/fixtures/hpux/machinfo/superdome-server-SD32B +53 -0
- data/spec/fixtures/hpux/machinfo/superdome2-16s +31 -0
- data/spec/fixtures/hpux/sched.models +174 -0
- data/spec/fixtures/hpux/unistd.h +1534 -0
- data/spec/fixtures/ifconfig/bsd_ifconfig_all_with_multiple_interfaces +18 -0
- data/spec/fixtures/ifconfig/centos_5_5 +17 -0
- data/spec/fixtures/ifconfig/centos_5_5_eth0 +8 -0
- data/spec/fixtures/ifconfig/darwin_10_3_0 +26 -0
- data/spec/fixtures/ifconfig/darwin_10_3_0_en0 +6 -0
- data/spec/fixtures/ifconfig/darwin_10_6_4 +28 -0
- data/spec/fixtures/ifconfig/darwin_10_6_4_en1 +6 -0
- data/spec/fixtures/ifconfig/darwin_10_6_6_dualstack +8 -0
- data/spec/fixtures/ifconfig/darwin_10_6_6_dualstack_en1 +7 -0
- data/spec/fixtures/ifconfig/darwin_9_8_0 +26 -0
- data/spec/fixtures/ifconfig/darwin_9_8_0_en0 +6 -0
- data/spec/fixtures/ifconfig/darwin_ifconfig_all_with_multiple_interfaces +23 -0
- data/spec/fixtures/ifconfig/fedora_10 +36 -0
- data/spec/fixtures/ifconfig/fedora_10_eth0 +9 -0
- data/spec/fixtures/ifconfig/fedora_13 +18 -0
- data/spec/fixtures/ifconfig/fedora_13_eth0 +9 -0
- data/spec/fixtures/ifconfig/fedora_8 +38 -0
- data/spec/fixtures/ifconfig/fedora_8_eth0 +9 -0
- data/spec/fixtures/ifconfig/freebsd_6_0 +12 -0
- data/spec/fixtures/ifconfig/ifconfig_net_tools_1.60.txt +19 -0
- data/spec/fixtures/ifconfig/ifconfig_ubuntu_1204.txt +16 -0
- data/spec/fixtures/ifconfig/linux_ifconfig_all_with_multiple_interfaces +19 -0
- data/spec/fixtures/ifconfig/linux_ifconfig_no_addr +19 -0
- data/spec/fixtures/ifconfig/linux_ifconfig_no_mac +8 -0
- data/spec/fixtures/ifconfig/linux_ifconfig_venet +24 -0
- data/spec/fixtures/ifconfig/open_solaris_10 +12 -0
- data/spec/fixtures/ifconfig/open_solaris_b132 +20 -0
- data/spec/fixtures/ifconfig/openbsd_bridge_rules +11 -0
- data/spec/fixtures/ifconfig/sunos_ifconfig_all_with_multiple_interfaces +10 -0
- data/spec/fixtures/ifconfig/ubuntu_7_04 +38 -0
- data/spec/fixtures/ifconfig/ubuntu_7_04_eth0 +9 -0
- data/spec/fixtures/ldom/ldom_v1 +6 -0
- data/spec/fixtures/netstat/centos_5_5 +5 -0
- data/spec/fixtures/netstat/darwin_10_3_0 +35 -0
- data/spec/fixtures/netstat/darwin_10_6_4 +29 -0
- data/spec/fixtures/netstat/darwin_10_6_6_dualstack +34 -0
- data/spec/fixtures/netstat/darwin_9_8_0 +28 -0
- data/spec/fixtures/netstat/fedora_10 +7 -0
- data/spec/fixtures/netstat/open_solaris_10 +16 -0
- data/spec/fixtures/netstat/open_solaris_b132 +17 -0
- data/spec/fixtures/netstat/ubuntu_7_04 +7 -0
- data/spec/fixtures/processorcount/solaris-psrinfo +24 -0
- data/spec/fixtures/processorcount/solaris-sparc-kstat-cpu-info +1216 -0
- data/spec/fixtures/processorcount/solaris-x86_64-kstat-cpu-info +225 -0
- data/spec/fixtures/unit/dhcp_servers/nmcli_devices +4 -0
- data/spec/fixtures/unit/dhcp_servers/nmcli_devices_disconnected +4 -0
- data/spec/fixtures/unit/dhcp_servers/nmcli_eth0_dhcp +36 -0
- data/spec/fixtures/unit/dhcp_servers/nmcli_eth0_static +24 -0
- data/spec/fixtures/unit/dhcp_servers/nmcli_wlan0_dhcp +49 -0
- data/spec/fixtures/unit/dhcp_servers/nmcli_wlan0_static +37 -0
- data/spec/fixtures/unit/dhcp_servers/route +3 -0
- data/spec/fixtures/unit/dhcp_servers/route_nogw +1 -0
- data/spec/fixtures/unit/ec2/rest/meta-data/root +20 -0
- data/spec/fixtures/unit/filesystems/linux +28 -0
- data/spec/fixtures/unit/gce/metadata/metadata.json +69 -0
- data/spec/fixtures/unit/interfaces/ifconfig_net_tools_1.60.txt +19 -0
- data/spec/fixtures/unit/interfaces/ifconfig_net_tools_1.60.txt.em1 +10 -0
- data/spec/fixtures/unit/interfaces/ifconfig_net_tools_1.60.txt.lo +8 -0
- data/spec/fixtures/unit/ipaddress/ifconfig_multiple_127_addresses.txt +20 -0
- data/spec/fixtures/unit/ipaddress/ifconfig_net_tools_1.60.txt +19 -0
- data/spec/fixtures/unit/ipaddress/ifconfig_non_english_locale.txt +18 -0
- data/spec/fixtures/unit/ipaddress/ifconfig_ubuntu_1204.txt +16 -0
- data/spec/fixtures/unit/kernelrelease/openbsd-5.3 +2 -0
- data/spec/fixtures/unit/kernelrelease/openbsd-5.3-current +3 -0
- data/spec/fixtures/unit/memory/aix-svmon +9 -0
- data/spec/fixtures/unit/memory/aix-swap_l +2 -0
- data/spec/fixtures/unit/memory/darwin-swapinfo-multiple +3 -0
- data/spec/fixtures/unit/memory/darwin-swapinfo-single +2 -0
- data/spec/fixtures/unit/memory/darwin-vm_stat +13 -0
- data/spec/fixtures/unit/memory/dragonfly-vmstat +3 -0
- data/spec/fixtures/unit/memory/freebsd-vmstat +3 -0
- data/spec/fixtures/unit/memory/linux-proc_meminfo +10 -0
- data/spec/fixtures/unit/memory/openbsd-vmstat +3 -0
- data/spec/fixtures/unit/memory/smartos_zone_swap_l-single +2 -0
- data/spec/fixtures/unit/memory/solaris-prtconf +4 -0
- data/spec/fixtures/unit/memory/solaris-swap_l-multiple +3 -0
- data/spec/fixtures/unit/memory/solaris-swap_l-single +2 -0
- data/spec/fixtures/unit/memory/solaris-vmstat +3 -0
- data/spec/fixtures/unit/netmask/darwin_10_8_5.txt +30 -0
- data/spec/fixtures/unit/netmask/ifconfig_aix_7.txt +3 -0
- data/spec/fixtures/unit/netmask/ifconfig_net_tools_1.60.txt +19 -0
- data/spec/fixtures/unit/netmask/ifconfig_ubuntu_1204.txt +16 -0
- data/spec/fixtures/unit/selinux/selinux_sestatus +6 -0
- data/spec/fixtures/unit/util/dhcp_servers/route +3 -0
- data/spec/fixtures/unit/util/dhcp_servers/route_nogw +1 -0
- data/spec/fixtures/unit/util/ec2/centos-arp-ec2.out +1 -0
- data/spec/fixtures/unit/util/ec2/linux-arp-ec2.out +1 -0
- data/spec/fixtures/unit/util/ec2/linux-arp-not-ec2.out +5 -0
- data/spec/fixtures/unit/util/ec2/solaris8_arp_a_not_ec2.out +7 -0
- data/spec/fixtures/unit/util/ec2/windows-2008-arp-a-not-ec2.out +6 -0
- data/spec/fixtures/unit/util/ec2/windows-2008-arp-a.out +10 -0
- data/spec/fixtures/unit/util/ip/6.0-STABLE_FreeBSD_ifconfig +12 -0
- data/spec/fixtures/unit/util/ip/Mac_OS_X_10.5.5_ifconfig +26 -0
- data/spec/fixtures/unit/util/ip/darwin_ifconfig_all_with_multiple_interfaces +10 -0
- data/spec/fixtures/unit/util/ip/darwin_ifconfig_single_interface +6 -0
- data/spec/fixtures/unit/util/ip/debian_kfreebsd_ifconfig +40 -0
- data/spec/fixtures/unit/util/ip/hpux_1111_ifconfig_lan0 +2 -0
- data/spec/fixtures/unit/util/ip/hpux_1111_ifconfig_lan1 +2 -0
- data/spec/fixtures/unit/util/ip/hpux_1111_ifconfig_lo0 +2 -0
- data/spec/fixtures/unit/util/ip/hpux_1111_lanscan +5 -0
- data/spec/fixtures/unit/util/ip/hpux_1111_netstat_in +4 -0
- data/spec/fixtures/unit/util/ip/hpux_1131_asterisk_ifconfig_lan0 +2 -0
- data/spec/fixtures/unit/util/ip/hpux_1131_asterisk_ifconfig_lan1 +2 -0
- data/spec/fixtures/unit/util/ip/hpux_1131_asterisk_ifconfig_lo0 +2 -0
- data/spec/fixtures/unit/util/ip/hpux_1131_asterisk_lanscan +5 -0
- data/spec/fixtures/unit/util/ip/hpux_1131_asterisk_netstat_in +4 -0
- data/spec/fixtures/unit/util/ip/hpux_1131_ifconfig_lan0 +2 -0
- data/spec/fixtures/unit/util/ip/hpux_1131_ifconfig_lan1 +2 -0
- data/spec/fixtures/unit/util/ip/hpux_1131_ifconfig_lo0 +2 -0
- data/spec/fixtures/unit/util/ip/hpux_1131_lanscan +4 -0
- data/spec/fixtures/unit/util/ip/hpux_1131_netstat_in +4 -0
- data/spec/fixtures/unit/util/ip/hpux_1131_nic_bonding_ifconfig_lan1 +2 -0
- data/spec/fixtures/unit/util/ip/hpux_1131_nic_bonding_ifconfig_lan4 +2 -0
- data/spec/fixtures/unit/util/ip/hpux_1131_nic_bonding_ifconfig_lan4_1 +2 -0
- data/spec/fixtures/unit/util/ip/hpux_1131_nic_bonding_ifconfig_lo0 +2 -0
- data/spec/fixtures/unit/util/ip/hpux_1131_nic_bonding_lanscan +9 -0
- data/spec/fixtures/unit/util/ip/hpux_1131_nic_bonding_netstat_in +6 -0
- data/spec/fixtures/unit/util/ip/linux_2_6_35_proc_net_bonding_bond0 +19 -0
- data/spec/fixtures/unit/util/ip/linux_get_single_interface_eth0 +10 -0
- data/spec/fixtures/unit/util/ip/linux_get_single_interface_ib0 +8 -0
- data/spec/fixtures/unit/util/ip/linux_get_single_interface_lo +9 -0
- data/spec/fixtures/unit/util/ip/linux_ifconfig_all_with_single_interface +18 -0
- data/spec/fixtures/unit/util/ip/linux_ifconfig_ib0 +8 -0
- data/spec/fixtures/unit/util/ip/solaris_ifconfig_all_with_multiple_interfaces +8 -0
- data/spec/fixtures/unit/util/ip/solaris_ifconfig_single_interface +3 -0
- data/spec/fixtures/unit/util/ip/windows_netsh_all_interfaces +12 -0
- data/spec/fixtures/unit/util/ip/windows_netsh_single_interface +7 -0
- data/spec/fixtures/unit/util/ip/windows_netsh_single_interface6 +18 -0
- data/spec/fixtures/unit/util/manufacturer/freebsd_dmidecode +42 -0
- data/spec/fixtures/unit/util/manufacturer/intel_linux_dmidecode +549 -0
- data/spec/fixtures/unit/util/manufacturer/linux_dmidecode_with_spaces +60 -0
- data/spec/fixtures/unit/util/manufacturer/opensolaris_smbios +33 -0
- data/spec/fixtures/unit/util/manufacturer/smartos_smbios +533 -0
- data/spec/fixtures/unit/util/manufacturer/solaris_sunfire_v120_prtdiag +33 -0
- data/spec/fixtures/unit/util/manufacturer/solaris_t5220_prtdiag +136 -0
- data/spec/fixtures/unit/util/operatingsystem/cumuluslinux.txt +8 -0
- data/spec/fixtures/unit/util/operatingsystem/redhat-7.txt +12 -0
- data/spec/fixtures/unit/util/operatingsystem/sabayon.txt +7 -0
- data/spec/fixtures/unit/util/operatingsystem/wheezy.txt +9 -0
- data/spec/fixtures/unit/util/partitions/partitions/mount +9 -0
- data/spec/fixtures/unit/util/processor/solaris-i86pc +28 -0
- data/spec/fixtures/unit/util/processor/solaris-sun4u +151 -0
- data/spec/fixtures/unit/util/processor/x86-pentium2 +41 -0
- data/spec/fixtures/unit/util/uptime/kstat_boot_time +1 -0
- data/spec/fixtures/unit/util/uptime/sysctl_kern_boottime_darwin +1 -0
- data/spec/fixtures/unit/util/uptime/sysctl_kern_boottime_openbsd +1 -0
- data/spec/fixtures/unit/util/uptime/ubuntu_proc_uptime +1 -0
- data/spec/fixtures/unit/util/virtual/invalid_unicode_dmi_entries +0 -0
- data/spec/fixtures/unit/util/virtual/solaris10_proc_self_status1 +0 -0
- data/spec/fixtures/unit/util/vlans/centos-5-no-vlans +2 -0
- data/spec/fixtures/unit/util/vlans/linux_vlan_config +6 -0
- data/spec/fixtures/unit/util/xendomains/xendomains +4 -0
- data/spec/fixtures/unit/virtual/sysfs_dmi_entries_raw.txt +0 -0
- data/spec/fixtures/unit/zfs_version/freebsd_8.2 +14 -0
- data/spec/fixtures/unit/zfs_version/freebsd_9.0 +13 -0
- data/spec/fixtures/unit/zfs_version/linux-fuse_0.6.9 +14 -0
- data/spec/fixtures/unit/zfs_version/solaris_10 +10 -0
- data/spec/fixtures/unit/zfs_version/solaris_11 +12 -0
- data/spec/fixtures/unit/zpool_version/freebsd_8.2 +26 -0
- data/spec/fixtures/unit/zpool_version/freebsd_9.0 +38 -0
- data/spec/fixtures/unit/zpool_version/linux-fuse_0.6.9 +35 -0
- data/spec/fixtures/unit/zpool_version/solaris_10 +31 -0
- data/spec/fixtures/unit/zpool_version/solaris_11 +43 -0
- data/spec/fixtures/virtual/proc_1_cgroup/in_a_container +9 -0
- data/spec/fixtures/virtual/proc_1_cgroup/in_a_docker_container +8 -0
- data/spec/fixtures/virtual/proc_1_cgroup/not_in_a_container +9 -0
- data/spec/fixtures/virtual/proc_self_status/vserver_2_1/guest +37 -0
- data/spec/fixtures/virtual/proc_self_status/vserver_2_1/host +36 -0
- data/spec/fixtures/virtual/proc_self_status/vserver_2_3/guest +39 -0
- data/spec/fixtures/virtual/proc_self_status/vserver_2_3/host +39 -0
- data/spec/integration/facter_spec.rb +39 -0
- data/spec/lib/facter_spec/cpuinfo.rb +15 -0
- data/spec/lib/facter_spec/windows_network.rb +64 -0
- data/spec/puppetlabs_spec/files.rb +57 -0
- data/spec/puppetlabs_spec/fixtures.rb +49 -0
- data/spec/puppetlabs_spec/matchers.rb +87 -0
- data/spec/puppetlabs_spec/verbose.rb +9 -0
- data/spec/puppetlabs_spec_helper.rb +26 -0
- data/spec/shared_contexts/platform.rb +55 -0
- data/spec/shared_formats/parses.rb +3 -0
- data/spec/spec_helper.rb +75 -0
- data/spec/unit/application_spec.rb +101 -0
- data/spec/unit/architecture_spec.rb +63 -0
- data/spec/unit/blockdevices_spec.rb +109 -0
- data/spec/unit/core/aggregate_spec.rb +125 -0
- data/spec/unit/core/directed_graph_spec.rb +79 -0
- data/spec/unit/core/execution/base_spec.rb +130 -0
- data/spec/unit/core/execution/posix_spec.rb +86 -0
- data/spec/unit/core/execution/windows_spec.rb +106 -0
- data/spec/unit/core/execution_spec.rb +42 -0
- data/spec/unit/core/logging_spec.rb +104 -0
- data/spec/unit/core/resolvable_spec.rb +81 -0
- data/spec/unit/core/suitable_spec.rb +106 -0
- data/spec/unit/dhcp_servers_spec.rb +152 -0
- data/spec/unit/domain_spec.rb +310 -0
- data/spec/unit/ec2/rest_spec.rb +145 -0
- data/spec/unit/ec2_spec.rb +127 -0
- data/spec/unit/facter_spec.rb +108 -0
- data/spec/unit/filesystems_spec.rb +50 -0
- data/spec/unit/fqdn_spec.rb +16 -0
- data/spec/unit/gce/metadata_spec.rb +49 -0
- data/spec/unit/gce_spec.rb +34 -0
- data/spec/unit/hardwareisa_spec.rb +41 -0
- data/spec/unit/hardwaremodel_spec.rb +56 -0
- data/spec/unit/hostname_spec.rb +40 -0
- data/spec/unit/id_spec.rb +29 -0
- data/spec/unit/interfaces_spec.rb +57 -0
- data/spec/unit/ipaddress6_spec.rb +161 -0
- data/spec/unit/ipaddress_spec.rb +114 -0
- data/spec/unit/kernel_spec.rb +24 -0
- data/spec/unit/kernelmajversion_spec.rb +22 -0
- data/spec/unit/kernelrelease_spec.rb +69 -0
- data/spec/unit/kernelversion_spec.rb +32 -0
- data/spec/unit/ldom_spec.rb +75 -0
- data/spec/unit/lsbdistcodename_spec.rb +25 -0
- data/spec/unit/lsbdistdescription_spec.rb +25 -0
- data/spec/unit/lsbdistid_spec.rb +25 -0
- data/spec/unit/lsbdistrelease_spec.rb +25 -0
- data/spec/unit/lsbmajdistrelease_spec.rb +13 -0
- data/spec/unit/lsbrelease_spec.rb +25 -0
- data/spec/unit/macaddress_spec.rb +73 -0
- data/spec/unit/manufacturer_spec.rb +115 -0
- data/spec/unit/memory_spec.rb +470 -0
- data/spec/unit/netmask_spec.rb +106 -0
- data/spec/unit/operatingsystem_spec.rb +160 -0
- data/spec/unit/operatingsystemmajrelease_spec.rb +38 -0
- data/spec/unit/operatingsystemrelease_spec.rb +236 -0
- data/spec/unit/osfamily_spec.rb +62 -0
- data/spec/unit/partitions_spec.rb +48 -0
- data/spec/unit/physicalprocessorcount_spec.rb +85 -0
- data/spec/unit/processor_spec.rb +401 -0
- data/spec/unit/ps_spec.rb +42 -0
- data/spec/unit/selinux_spec.rb +114 -0
- data/spec/unit/ssh_spec.rb +77 -0
- data/spec/unit/uniqueid_spec.rb +27 -0
- data/spec/unit/uptime_spec.rb +110 -0
- data/spec/unit/util/collection_spec.rb +258 -0
- data/spec/unit/util/config_spec.rb +97 -0
- data/spec/unit/util/confine_spec.rb +148 -0
- data/spec/unit/util/dhcp_servers_spec.rb +63 -0
- data/spec/unit/util/directory_loader_spec.rb +88 -0
- data/spec/unit/util/ec2_spec.rb +184 -0
- data/spec/unit/util/fact_spec.rb +142 -0
- data/spec/unit/util/file_read_spec.rb +29 -0
- data/spec/unit/util/formatter_spec.rb +50 -0
- data/spec/unit/util/ip/windows_spec.rb +80 -0
- data/spec/unit/util/ip_spec.rb +467 -0
- data/spec/unit/util/loader_spec.rb +286 -0
- data/spec/unit/util/macaddress_spec.rb +141 -0
- data/spec/unit/util/macosx_spec.rb +114 -0
- data/spec/unit/util/manufacturer_spec.rb +223 -0
- data/spec/unit/util/normalization_spec.rb +113 -0
- data/spec/unit/util/operatingsystem_spec.rb +92 -0
- data/spec/unit/util/parser_spec.rb +200 -0
- data/spec/unit/util/partitions/partitions_spec.rb +67 -0
- data/spec/unit/util/partitions_spec.rb +19 -0
- data/spec/unit/util/posix_spec.rb +11 -0
- data/spec/unit/util/processor_spec.rb +92 -0
- data/spec/unit/util/registry_spec.rb +76 -0
- data/spec/unit/util/resolution_spec.rb +129 -0
- data/spec/unit/util/solaris_zones_spec.rb +127 -0
- data/spec/unit/util/uptime_spec.rb +126 -0
- data/spec/unit/util/values_spec.rb +171 -0
- data/spec/unit/util/virtual_spec.rb +364 -0
- data/spec/unit/util/vlans_spec.rb +42 -0
- data/spec/unit/util/wmi_spec.rb +19 -0
- data/spec/unit/util/xendomains_spec.rb +21 -0
- data/spec/unit/version_spec.rb +42 -0
- data/spec/unit/virtual_spec.rb +519 -0
- data/spec/unit/zfs_version_spec.rb +75 -0
- data/spec/unit/zonename_spec.rb +14 -0
- data/spec/unit/zones_spec.rb +55 -0
- data/spec/unit/zpool_version_spec.rb +75 -0
- data/spec/watchr.rb +125 -0
- metadata +815 -0
@@ -0,0 +1,62 @@
|
|
1
|
+
#! /usr/bin/env ruby
|
2
|
+
|
3
|
+
require 'spec_helper'
|
4
|
+
|
5
|
+
describe "OS Family fact" do
|
6
|
+
|
7
|
+
{
|
8
|
+
'Archlinux' => 'Archlinux',
|
9
|
+
'SmartOS' => 'Solaris',
|
10
|
+
'OpenIndiana' => 'Solaris',
|
11
|
+
'OmniOS' => 'Solaris',
|
12
|
+
'Nexenta' => 'Solaris',
|
13
|
+
'Solaris' => 'Solaris',
|
14
|
+
'Ubuntu' => 'Debian',
|
15
|
+
'Debian' => 'Debian',
|
16
|
+
'LinuxMint' => 'Debian',
|
17
|
+
'Gentoo' => 'Gentoo',
|
18
|
+
'Fedora' => 'RedHat',
|
19
|
+
'Amazon' => 'RedHat',
|
20
|
+
'OracleLinux' => 'RedHat',
|
21
|
+
'OVS' => 'RedHat',
|
22
|
+
'OEL' => 'RedHat',
|
23
|
+
'CentOS' => 'RedHat',
|
24
|
+
'SLC' => 'RedHat',
|
25
|
+
'Scientific' => 'RedHat',
|
26
|
+
'CloudLinux' => 'RedHat',
|
27
|
+
'PSBM' => 'RedHat',
|
28
|
+
'Ascendos' => 'RedHat',
|
29
|
+
'XenServer' => 'RedHat',
|
30
|
+
'RedHat' => 'RedHat',
|
31
|
+
'SLES' => 'Suse',
|
32
|
+
'SLED' => 'Suse',
|
33
|
+
'OpenSuSE' => 'Suse',
|
34
|
+
'SuSE' => 'Suse',
|
35
|
+
'Mageia' => 'Mandrake',
|
36
|
+
'Mandriva' => 'Mandrake',
|
37
|
+
'Mandrake' => 'Mandrake',
|
38
|
+
}.each do |os,family|
|
39
|
+
it "should return #{family} on operatingsystem #{os}" do
|
40
|
+
Facter.fact(:operatingsystem).stubs(:value).returns os
|
41
|
+
Facter.fact(:osfamily).value.should == family
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
45
|
+
[
|
46
|
+
'MeeGo',
|
47
|
+
'VMWareESX',
|
48
|
+
'Bluewhite64',
|
49
|
+
'Slamd64',
|
50
|
+
'Slackware',
|
51
|
+
'Alpine',
|
52
|
+
'ESXi',
|
53
|
+
'windows',
|
54
|
+
'HP-UX'
|
55
|
+
].each do |os|
|
56
|
+
it "should return the kernel fact on operatingsystem #{os}" do
|
57
|
+
Facter.fact(:operatingsystem).stubs(:value).returns os
|
58
|
+
Facter.fact(:kernel).stubs(:value).returns 'random_kernel_fact'
|
59
|
+
Facter.fact(:osfamily).value.should == 'random_kernel_fact'
|
60
|
+
end
|
61
|
+
end
|
62
|
+
end
|
@@ -0,0 +1,48 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require 'spec_helper'
|
4
|
+
require 'facter'
|
5
|
+
|
6
|
+
describe "Partition facts" do
|
7
|
+
|
8
|
+
describe "on non-Linux OS" do
|
9
|
+
|
10
|
+
it "should not exist when kernel isn't Linux" do
|
11
|
+
Facter.fact(:kernel).stubs(:value).returns("SunOS")
|
12
|
+
Facter.fact(:partitions).value.should == nil
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
describe "on Linux" do
|
17
|
+
it "should return a structured fact with uuid, size, mount point and filesytem for each partition" do
|
18
|
+
partitions = {
|
19
|
+
'sda1' => {
|
20
|
+
'uuid' => '13459663-22cc-47b4-a9e6-21dea9906e03',
|
21
|
+
'size' => '1234',
|
22
|
+
'mount' => '/',
|
23
|
+
'filesystem' => 'ext4',
|
24
|
+
},
|
25
|
+
'sdb2' => {
|
26
|
+
'uuid' => '98043570-eb10-457f-9718-0b85a26e66bf',
|
27
|
+
'size' => '5678',
|
28
|
+
'mount' => '/home',
|
29
|
+
'filesystem' => 'xfs',
|
30
|
+
},
|
31
|
+
}
|
32
|
+
|
33
|
+
Facter::Util::Partitions.stubs(:list).returns( partitions.keys )
|
34
|
+
|
35
|
+
partitions.each do |part,vals|
|
36
|
+
Facter::Util::Partitions.stubs(:uuid).with(part).returns(vals['uuid'])
|
37
|
+
Facter::Util::Partitions.stubs(:size).with(part).returns(vals['size'])
|
38
|
+
Facter::Util::Partitions.stubs(:mount).with(part).returns(vals['mount'])
|
39
|
+
Facter::Util::Partitions.stubs(:filesystem).with(part).returns(vals['filesystem'])
|
40
|
+
end
|
41
|
+
|
42
|
+
Facter.fact(:partitions).value.should == {
|
43
|
+
'sda1' => { 'uuid' => '13459663-22cc-47b4-a9e6-21dea9906e03', 'size' => '1234', 'mount' => '/', 'filesystem' => 'ext4' },
|
44
|
+
'sdb2' => { 'uuid' => '98043570-eb10-457f-9718-0b85a26e66bf', 'size' => '5678', 'mount' => '/home', 'filesystem' => 'xfs' },
|
45
|
+
}
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
@@ -0,0 +1,85 @@
|
|
1
|
+
#! /usr/bin/env ruby
|
2
|
+
|
3
|
+
require 'spec_helper'
|
4
|
+
require 'facter/util/posix'
|
5
|
+
|
6
|
+
describe "Physical processor count facts" do
|
7
|
+
|
8
|
+
describe "on linux" do
|
9
|
+
before :each do
|
10
|
+
Facter.fact(:kernel).stubs(:value).returns("Linux")
|
11
|
+
File.stubs(:exists?).with('/sys/devices/system/cpu').returns(true)
|
12
|
+
end
|
13
|
+
|
14
|
+
it "should return one physical CPU" do
|
15
|
+
Dir.stubs(:glob).with("/sys/devices/system/cpu/cpu*/topology/physical_package_id").returns(["/sys/devices/system/cpu/cpu0/topology/physical_package_id"])
|
16
|
+
Facter::Core::Execution.stubs(:exec).with("cat /sys/devices/system/cpu/cpu0/topology/physical_package_id").returns("0")
|
17
|
+
|
18
|
+
Facter.fact(:physicalprocessorcount).value.should == "1"
|
19
|
+
end
|
20
|
+
|
21
|
+
it "should return four physical CPUs" do
|
22
|
+
Dir.stubs(:glob).with("/sys/devices/system/cpu/cpu*/topology/physical_package_id").returns(%w{
|
23
|
+
/sys/devices/system/cpu/cpu0/topology/physical_package_id
|
24
|
+
/sys/devices/system/cpu/cpu1/topology/physical_package_id
|
25
|
+
/sys/devices/system/cpu/cpu2/topology/physical_package_id
|
26
|
+
/sys/devices/system/cpu/cpu3/topology/physical_package_id
|
27
|
+
})
|
28
|
+
|
29
|
+
Facter::Core::Execution.stubs(:exec).with("cat /sys/devices/system/cpu/cpu0/topology/physical_package_id").returns("0")
|
30
|
+
Facter::Core::Execution.stubs(:exec).with("cat /sys/devices/system/cpu/cpu1/topology/physical_package_id").returns("1")
|
31
|
+
Facter::Core::Execution.stubs(:exec).with("cat /sys/devices/system/cpu/cpu2/topology/physical_package_id").returns("2")
|
32
|
+
Facter::Core::Execution.stubs(:exec).with("cat /sys/devices/system/cpu/cpu3/topology/physical_package_id").returns("3")
|
33
|
+
|
34
|
+
Facter.fact(:physicalprocessorcount).value.should == "4"
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
38
|
+
describe "on windows" do
|
39
|
+
it "should return 4 physical CPUs" do
|
40
|
+
Facter.fact(:kernel).stubs(:value).returns("windows")
|
41
|
+
|
42
|
+
require 'facter/util/wmi'
|
43
|
+
ole = stub 'WIN32OLE'
|
44
|
+
Facter::Util::WMI.expects(:execquery).with("select Name from Win32_Processor").returns(ole)
|
45
|
+
ole.stubs(:Count).returns(4)
|
46
|
+
|
47
|
+
Facter.fact(:physicalprocessorcount).value.should == "4"
|
48
|
+
end
|
49
|
+
end
|
50
|
+
|
51
|
+
describe "on solaris" do
|
52
|
+
let(:psrinfo) do
|
53
|
+
"0 on-line since 10/16/2012 14:06:12\n" +
|
54
|
+
"1 on-line since 10/16/2012 14:06:14\n"
|
55
|
+
end
|
56
|
+
|
57
|
+
%w{ 5.8 5.9 5.10 5.11 }.each do |release|
|
58
|
+
it "should use the output of psrinfo -p on #{release}" do
|
59
|
+
Facter.fact(:kernel).stubs(:value).returns(:sunos)
|
60
|
+
Facter.stubs(:value).with(:kernelrelease).returns(release)
|
61
|
+
|
62
|
+
Facter::Core::Execution.expects(:exec).with("/usr/sbin/psrinfo -p").returns("1")
|
63
|
+
Facter.fact(:physicalprocessorcount).value.should == "1"
|
64
|
+
end
|
65
|
+
end
|
66
|
+
|
67
|
+
%w{ 5.5.1 5.6 5.7 }.each do |release|
|
68
|
+
it "uses psrinfo with no -p for kernelrelease #{release}" do
|
69
|
+
Facter.fact(:kernel).stubs(:value).returns(:sunos)
|
70
|
+
Facter.stubs(:value).with(:kernelrelease).returns(release)
|
71
|
+
|
72
|
+
Facter::Core::Execution.expects(:exec).with("/usr/sbin/psrinfo").returns(psrinfo)
|
73
|
+
Facter.fact(:physicalprocessorcount).value.should == "2"
|
74
|
+
end
|
75
|
+
end
|
76
|
+
end
|
77
|
+
|
78
|
+
describe "on openbsd" do
|
79
|
+
it "should return 4 physical CPUs" do
|
80
|
+
Facter.fact(:kernel).stubs(:value).returns("OpenBSD")
|
81
|
+
Facter::Util::POSIX.expects(:sysctl).with("hw.ncpufound").returns("4")
|
82
|
+
Facter.fact(:physicalprocessorcount).value.should == "4"
|
83
|
+
end
|
84
|
+
end
|
85
|
+
end
|
@@ -0,0 +1,401 @@
|
|
1
|
+
#! /usr/bin/env ruby
|
2
|
+
|
3
|
+
require 'facter/util/posix'
|
4
|
+
require 'facter/util/processor'
|
5
|
+
require 'spec_helper'
|
6
|
+
require 'facter_spec/cpuinfo'
|
7
|
+
|
8
|
+
describe "Processor facts" do
|
9
|
+
describe "on Windows" do
|
10
|
+
before :each do
|
11
|
+
Facter.clear
|
12
|
+
Facter.fact(:kernel).stubs(:value).returns("windows")
|
13
|
+
end
|
14
|
+
|
15
|
+
def load(procs)
|
16
|
+
require 'facter/util/wmi'
|
17
|
+
Facter::Util::WMI.stubs(:execquery).with("select * from Win32_Processor").returns(procs)
|
18
|
+
# This is to workaround #14674
|
19
|
+
Facter.fact(:architecture).stubs(:value).returns("x64")
|
20
|
+
|
21
|
+
# processor facts belong to a file with a different name,
|
22
|
+
# so load the file explicitly (after stubbing kernel),
|
23
|
+
# but we have to stub execquery first
|
24
|
+
Facter.collection.internal_loader.load(:processor)
|
25
|
+
end
|
26
|
+
|
27
|
+
describe "2003" do
|
28
|
+
before :each do
|
29
|
+
proc = stubs 'proc'
|
30
|
+
proc.stubs(:Name).returns("Intel(R) Celeron(R) processor")
|
31
|
+
|
32
|
+
load(Array.new(2, proc))
|
33
|
+
end
|
34
|
+
|
35
|
+
it "should count 2 processors" do
|
36
|
+
proc.expects(:NumberOfLogicalProcessors).never
|
37
|
+
|
38
|
+
Facter.fact(:processorcount).value.should == "2"
|
39
|
+
end
|
40
|
+
|
41
|
+
it "should squeeze the processor name 2 times" do
|
42
|
+
2.times do |i|
|
43
|
+
Facter.fact("processor#{i}".to_sym).value.should == "Intel(R) Celeron(R) processor"
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
47
|
+
|
48
|
+
describe "2008" do
|
49
|
+
before :each do
|
50
|
+
proc = stubs 'proc'
|
51
|
+
proc.stubs(:NumberOfLogicalProcessors).returns(2)
|
52
|
+
proc.stubs(:Name).returns("Intel(R) Celeron(R) processor")
|
53
|
+
|
54
|
+
load(Array.new(2, proc))
|
55
|
+
end
|
56
|
+
|
57
|
+
it "should count 4 processors" do
|
58
|
+
Facter.fact(:processorcount).value.should == "4"
|
59
|
+
end
|
60
|
+
|
61
|
+
it "should squeeze the processor name 4 times" do
|
62
|
+
4.times do |i|
|
63
|
+
Facter.fact("processor#{i}".to_sym).value.should == "Intel(R) Celeron(R) processor"
|
64
|
+
end
|
65
|
+
end
|
66
|
+
end
|
67
|
+
end
|
68
|
+
|
69
|
+
describe "on Linux" do
|
70
|
+
include FacterSpec::Cpuinfo
|
71
|
+
|
72
|
+
shared_context 'Linux processor stubs' do
|
73
|
+
before :each do
|
74
|
+
Facter.collection.internal_loader.load(:processor)
|
75
|
+
|
76
|
+
Facter.fact(:kernel).stubs(:value).returns 'Linux'
|
77
|
+
Facter.fact(:operatingsystem).stubs(:value).returns 'Linux'
|
78
|
+
File.stubs(:exists?).with("/proc/cpuinfo").returns(true)
|
79
|
+
end
|
80
|
+
end
|
81
|
+
|
82
|
+
shared_examples_for 'a /proc/cpuinfo based processor fact' do |processor_fact|
|
83
|
+
include_context 'Linux processor stubs'
|
84
|
+
|
85
|
+
it "should be 1 in SPARC fixture" do
|
86
|
+
Facter.fact(:architecture).stubs(:value).returns("sparc")
|
87
|
+
File.stubs(:readlines).with("/proc/cpuinfo").returns(cpuinfo_fixture_readlines("sparc"))
|
88
|
+
|
89
|
+
Facter.fact(processor_fact).value.should == "1"
|
90
|
+
end
|
91
|
+
|
92
|
+
it "should be 2 in ppc64 fixture on Linux" do
|
93
|
+
Facter.fact(:architecture).stubs(:value).returns("ppc64")
|
94
|
+
File.stubs(:readlines).with("/proc/cpuinfo").returns(cpuinfo_fixture_readlines("ppc64"))
|
95
|
+
|
96
|
+
Facter.fact(processor_fact).value.should == "2"
|
97
|
+
end
|
98
|
+
|
99
|
+
it "should be 2 in panda-armel fixture on Linux" do
|
100
|
+
Facter.fact(:architecture).stubs(:value).returns("arm")
|
101
|
+
File.stubs(:readlines).with("/proc/cpuinfo").returns(cpuinfo_fixture_readlines("panda-armel"))
|
102
|
+
|
103
|
+
Facter.fact(processor_fact).value.should == "2"
|
104
|
+
end
|
105
|
+
|
106
|
+
it "should be 1 in bbg3-armel fixture on Linux" do
|
107
|
+
Facter.fact(:architecture).stubs(:value).returns("arm")
|
108
|
+
File.stubs(:readlines).with("/proc/cpuinfo").returns(cpuinfo_fixture_readlines("bbg3-armel"))
|
109
|
+
|
110
|
+
Facter.fact(processor_fact).value.should == "1"
|
111
|
+
end
|
112
|
+
|
113
|
+
it "should be 1 in beaglexm-armel fixture on Linux" do
|
114
|
+
Facter.fact(:architecture).stubs(:value).returns("arm")
|
115
|
+
File.stubs(:readlines).with("/proc/cpuinfo").returns(cpuinfo_fixture_readlines("beaglexm-armel"))
|
116
|
+
|
117
|
+
Facter.fact(processor_fact).value.should == "1"
|
118
|
+
end
|
119
|
+
|
120
|
+
it "should be 1 in amd64solo fixture on Linux" do
|
121
|
+
Facter.fact(:architecture).stubs(:value).returns("amd64")
|
122
|
+
File.stubs(:readlines).with("/proc/cpuinfo").returns(cpuinfo_fixture_readlines("amd64solo"))
|
123
|
+
|
124
|
+
Facter.fact(processor_fact).value.should == "1"
|
125
|
+
end
|
126
|
+
|
127
|
+
it "should be 2 in amd64dual fixture on Linux" do
|
128
|
+
Facter.fact(:architecture).stubs(:value).returns("amd64")
|
129
|
+
File.stubs(:readlines).with("/proc/cpuinfo").returns(cpuinfo_fixture_readlines("amd64dual"))
|
130
|
+
|
131
|
+
Facter.fact(processor_fact).value.should == "2"
|
132
|
+
end
|
133
|
+
|
134
|
+
it "should be 3 in amd64tri fixture on Linux" do
|
135
|
+
Facter.fact(:architecture).stubs(:value).returns("amd64")
|
136
|
+
File.stubs(:readlines).with("/proc/cpuinfo").returns(cpuinfo_fixture_readlines("amd64tri"))
|
137
|
+
|
138
|
+
Facter.fact(processor_fact).value.should == "3"
|
139
|
+
end
|
140
|
+
|
141
|
+
it "should be 4 in amd64quad fixture on Linux" do
|
142
|
+
Facter.fact(:architecture).stubs(:value).returns("amd64")
|
143
|
+
File.stubs(:readlines).with("/proc/cpuinfo").returns(cpuinfo_fixture_readlines("amd64quad"))
|
144
|
+
|
145
|
+
Facter.fact(processor_fact).value.should == "4"
|
146
|
+
end
|
147
|
+
end
|
148
|
+
|
149
|
+
it_behaves_like 'a /proc/cpuinfo based processor fact', :processorcount
|
150
|
+
|
151
|
+
def sysfs_cpu_stubs(count)
|
152
|
+
(0...count).map { |index| "/sys/devices/system/cpu/cpu#{index}" }
|
153
|
+
end
|
154
|
+
|
155
|
+
describe 'when /proc/cpuinfo returns 0 processors (#2945)' do
|
156
|
+
include_context 'Linux processor stubs'
|
157
|
+
|
158
|
+
before do
|
159
|
+
File.stubs(:readlines).with("/proc/cpuinfo").returns([])
|
160
|
+
File.stubs(:exists?).with("/sys/devices/system/cpu").returns(true)
|
161
|
+
end
|
162
|
+
|
163
|
+
it "should be 2 via sysfs when cpu0 and cpu1 are present" do
|
164
|
+
Dir.stubs(:glob).with("/sys/devices/system/cpu/cpu[0-9]*").returns(
|
165
|
+
sysfs_cpu_stubs(2)
|
166
|
+
)
|
167
|
+
|
168
|
+
Facter.fact(:processorcount).value.should == "2"
|
169
|
+
end
|
170
|
+
|
171
|
+
it "should be 16 via sysfs when cpu0 through cpu15 are present" do
|
172
|
+
Dir.stubs(:glob).with("/sys/devices/system/cpu/cpu[0-9]*").returns(
|
173
|
+
sysfs_cpu_stubs(16)
|
174
|
+
)
|
175
|
+
|
176
|
+
Facter.fact(:processorcount).value.should == "16"
|
177
|
+
end
|
178
|
+
end
|
179
|
+
end
|
180
|
+
|
181
|
+
|
182
|
+
describe "on Unixes" do
|
183
|
+
before :each do
|
184
|
+
Facter.collection.internal_loader.load(:processor)
|
185
|
+
end
|
186
|
+
|
187
|
+
it "should be 2 on dual-processor Darwin box" do
|
188
|
+
Facter.fact(:kernel).stubs(:value).returns("Darwin")
|
189
|
+
Facter::Util::POSIX.stubs(:sysctl).with("hw.ncpu").returns('2')
|
190
|
+
|
191
|
+
Facter.fact(:processorcount).value.should == "2"
|
192
|
+
end
|
193
|
+
|
194
|
+
it "should be 2 on dual-processor OpenBSD box" do
|
195
|
+
Facter.fact(:kernel).stubs(:value).returns("OpenBSD")
|
196
|
+
Facter::Util::POSIX.stubs(:sysctl).with("hw.ncpu").returns('2')
|
197
|
+
|
198
|
+
Facter.fact(:processorcount).value.should == "2"
|
199
|
+
end
|
200
|
+
|
201
|
+
it "should print the correct CPU Model on OpenBSD" do
|
202
|
+
Facter.fact(:kernel).stubs(:value).returns("OpenBSD")
|
203
|
+
Facter::Util::POSIX.stubs(:sysctl).with("hw.model").returns('SomeVendor CPU 4.2GHz')
|
204
|
+
|
205
|
+
Facter.fact(:processor).value.should == "SomeVendor CPU 4.2GHz"
|
206
|
+
end
|
207
|
+
|
208
|
+
it "should be 2 on dual-processor FreeBSD box" do
|
209
|
+
Facter.fact(:kernel).stubs(:value).returns("FreeBSD")
|
210
|
+
Facter::Util::POSIX.stubs(:sysctl).with("hw.ncpu").returns('2')
|
211
|
+
|
212
|
+
Facter.fact(:processorcount).value.should == "2"
|
213
|
+
end
|
214
|
+
|
215
|
+
it "should print the correct CPU Model on FreeBSD" do
|
216
|
+
Facter.fact(:kernel).stubs(:value).returns("FreeBSD")
|
217
|
+
Facter::Util::POSIX.stubs(:sysctl).with("hw.model").returns('SomeVendor CPU 3GHz')
|
218
|
+
|
219
|
+
Facter.fact(:processor).value.should == "SomeVendor CPU 3GHz"
|
220
|
+
end
|
221
|
+
|
222
|
+
it "should be 2 on dual-processor DragonFly box" do
|
223
|
+
Facter.fact(:kernel).stubs(:value).returns("DragonFly")
|
224
|
+
Facter::Util::POSIX.stubs(:sysctl).with("hw.ncpu").returns('2')
|
225
|
+
|
226
|
+
Facter.fact(:processorcount).value.should == "2"
|
227
|
+
end
|
228
|
+
end
|
229
|
+
|
230
|
+
describe "on solaris" do
|
231
|
+
before :each do
|
232
|
+
Facter::Util::Processor.stubs(:kernel_fact_value).returns :sunos
|
233
|
+
Facter.fact(:kernel).stubs(:value).returns(:sunos)
|
234
|
+
Facter.collection.internal_loader.load(:processor)
|
235
|
+
end
|
236
|
+
|
237
|
+
before :all do
|
238
|
+
@fixture_kstat_sparc = File.read(fixtures('processorcount','solaris-sparc-kstat-cpu-info'))
|
239
|
+
@fixture_kstat_x86_64 = File.read(fixtures('processorcount','solaris-x86_64-kstat-cpu-info'))
|
240
|
+
end
|
241
|
+
|
242
|
+
let(:kstat_sparc) { @fixture_kstat_sparc }
|
243
|
+
let(:kstat_x86_64) { @fixture_kstat_x86_64 }
|
244
|
+
|
245
|
+
%w{ 5.5.1 5.6 5.7 }.each do |release|
|
246
|
+
%w{ sparc x86_64 }.each do |arch|
|
247
|
+
it "uses kstat on release #{release} (#{arch})" do
|
248
|
+
Facter.stubs(:value).with(:kernelrelease).returns(release)
|
249
|
+
|
250
|
+
Facter::Core::Execution.expects(:exec).with("/usr/sbin/psrinfo").never
|
251
|
+
Facter::Core::Execution.expects(:exec).with("/usr/bin/kstat cpu_info").returns(self.send("kstat_#{arch}".intern))
|
252
|
+
Facter.fact(:processorcount).value.should == '8'
|
253
|
+
end
|
254
|
+
end
|
255
|
+
end
|
256
|
+
|
257
|
+
%w{ 5.8 5.9 5.10 5.11 }.each do |release|
|
258
|
+
it "uses psrinfo on release #{release}" do
|
259
|
+
Facter.stubs(:value).with(:kernelrelease).returns(release)
|
260
|
+
|
261
|
+
fixture_data = File.read(fixtures('processorcount','solaris-psrinfo'))
|
262
|
+
Facter::Core::Execution.expects(:exec).with("/usr/bin/kstat cpu_info").never
|
263
|
+
Facter::Core::Execution.expects(:exec).with("/usr/sbin/psrinfo").returns(fixture_data)
|
264
|
+
Facter.fact(:processorcount).value.should == '24'
|
265
|
+
end
|
266
|
+
end
|
267
|
+
end
|
268
|
+
end
|
269
|
+
|
270
|
+
describe "processorX facts" do
|
271
|
+
describe "on AIX" do
|
272
|
+
def self.lsdev_examples
|
273
|
+
examples = []
|
274
|
+
examples << "proc0 Available 00-00 Processor\n" +
|
275
|
+
"proc4 Available 00-04 Processor\n" +
|
276
|
+
"proc8 Defined 00-08 Processor\n" +
|
277
|
+
"proc12 Defined 00-12 Processor\n"
|
278
|
+
examples
|
279
|
+
end
|
280
|
+
|
281
|
+
let(:lsattr) do
|
282
|
+
"type PowerPC_POWER5 Processor type False\n"
|
283
|
+
end
|
284
|
+
|
285
|
+
lsdev_examples.each_with_index do |lsdev_example, i|
|
286
|
+
context "lsdev example ##{i}" do
|
287
|
+
before :each do
|
288
|
+
Facter.fact(:kernel).stubs(:value).returns("AIX")
|
289
|
+
Facter::Util::Processor.stubs(:lsdev).returns(lsdev_example)
|
290
|
+
Facter::Util::Processor.stubs(:lsattr).returns(lsattr)
|
291
|
+
Facter.collection.internal_loader.load(:processor)
|
292
|
+
end
|
293
|
+
|
294
|
+
lsdev_example.split("\n").each_with_index do |line, idx|
|
295
|
+
aix_idx = idx * 4
|
296
|
+
it "maps proc#{aix_idx} to processor#{idx} (#11609)" do
|
297
|
+
Facter.value("processor#{idx}").should == "PowerPC_POWER5"
|
298
|
+
end
|
299
|
+
end
|
300
|
+
end
|
301
|
+
end
|
302
|
+
end
|
303
|
+
|
304
|
+
describe "on HP-UX" do
|
305
|
+
def self.machinfo_examples
|
306
|
+
examples = []
|
307
|
+
examples << [File.read(fixtures('hpux','machinfo','ia64-rx2620')), "Intel(R) Itanium 2 processor"]
|
308
|
+
examples << [File.read(fixtures('hpux','machinfo','ia64-rx6600')), "Intel(R) Itanium 2 9100 series processor (1.59 GHz, 18 MB)"]
|
309
|
+
examples << [File.read(fixtures('hpux','machinfo','ia64-rx8640')), "Intel(R) Itanium 2 9100 series"]
|
310
|
+
examples << [File.read(fixtures('hpux','machinfo','hppa-rp4440')), "PA-RISC 8800 processor (1000 MHz, 64 MB)"]
|
311
|
+
examples << [File.read(fixtures('hpux','machinfo','superdome-server-SD32B')), "Intel(R) Itanium 2 9000 series"]
|
312
|
+
examples << [File.read(fixtures('hpux','machinfo','superdome2-16s')), "Intel(R) Itanium(R) Processor 9340 (1.6 GHz, 15 MB)"]
|
313
|
+
examples
|
314
|
+
end
|
315
|
+
|
316
|
+
let(:ioscan) do
|
317
|
+
"Class I H/W Path Driver S/W State H/W Type Description\n" +
|
318
|
+
"===================================================================\n" +
|
319
|
+
"processor 0 0/120 processor CLAIMED PROCESSOR Processor\n" +
|
320
|
+
"processor 1 0/123 processor CLAIMED PROCESSOR Processor\n"
|
321
|
+
end
|
322
|
+
|
323
|
+
describe "when machinfo is available" do
|
324
|
+
machinfo_examples.each_with_index do |example, i|
|
325
|
+
machinfo_example, expected_cpu = example
|
326
|
+
context "machinfo example ##{i}" do
|
327
|
+
before :each do
|
328
|
+
Facter.fact(:kernel).stubs(:value).returns("HP-UX")
|
329
|
+
Facter::Util::Processor.stubs(:ioscan).returns(ioscan)
|
330
|
+
Facter::Util::Processor.stubs(:machinfo).returns(machinfo_example)
|
331
|
+
Facter.collection.internal_loader.load(:processor)
|
332
|
+
end
|
333
|
+
|
334
|
+
%w{ 0 1 }.each do |j|
|
335
|
+
it "should find #{expected_cpu}" do
|
336
|
+
Facter.value("processor#{j}").should == expected_cpu
|
337
|
+
end
|
338
|
+
end
|
339
|
+
end
|
340
|
+
end
|
341
|
+
end
|
342
|
+
|
343
|
+
def self.model_and_getconf_examples
|
344
|
+
examples = []
|
345
|
+
examples << ["9000/800/L3000-5x", "sched.models_present", "unistd.h_present", "532", "616", "PA-RISC 8600 processor"]
|
346
|
+
examples << ["9000/800/L3000-5x", "", "unistd.h_present", "532", "616", "HP PA-RISC2.0 CHIP TYPE #616"]
|
347
|
+
examples << ["9000/800/L3000-5x", "", "", "532", "616", "CPU v532 CHIP TYPE #616"]
|
348
|
+
examples << ["ia64 hp server rx2660", "sched.models_present", "unistd.h_present", "768", "536936708", "IA-64 archrev 0 CHIP TYPE #536936708"]
|
349
|
+
examples << ["ia64 hp server rx2660", "", "unistd.h_present", "768", "536936708", "IA-64 archrev 0 CHIP TYPE #536936708"]
|
350
|
+
examples << ["ia64 hp server rx2660", "", "", "768", "536936708", "CPU v768 CHIP TYPE #536936708"]
|
351
|
+
examples
|
352
|
+
end
|
353
|
+
|
354
|
+
sched_models = File.readlines(fixtures('hpux','sched.models'))
|
355
|
+
unistd_h = File.readlines(fixtures('hpux','unistd.h'))
|
356
|
+
|
357
|
+
describe "when machinfo is not available" do
|
358
|
+
model_and_getconf_examples.each_with_index do |example, i|
|
359
|
+
model_example, sm, unistd, getconf_cpu_ver, getconf_chip_type, expected_cpu = example
|
360
|
+
context "and model and getconf example ##{i}" do
|
361
|
+
before :each do
|
362
|
+
Facter.fact(:kernel).stubs(:value).returns("HP-UX")
|
363
|
+
Facter::Util::Processor.stubs(:ioscan).returns(ioscan)
|
364
|
+
Facter::Util::Processor.stubs(:getconf_cpu_version).returns(getconf_cpu_ver)
|
365
|
+
Facter::Util::Processor.stubs(:getconf_cpu_chip_type).returns(getconf_chip_type)
|
366
|
+
Facter::Util::Processor.stubs(:machinfo).returns(nil)
|
367
|
+
Facter::Util::Processor.stubs(:model).returns(model_example)
|
368
|
+
end
|
369
|
+
|
370
|
+
if unistd == "unistd.h_present" then
|
371
|
+
before :each do
|
372
|
+
Facter::Util::Processor.stubs(:read_unistd_h).returns(unistd_h)
|
373
|
+
end
|
374
|
+
else
|
375
|
+
before :each do
|
376
|
+
Facter::Util::Processor.stubs(:read_unistd_h).returns(nil)
|
377
|
+
end
|
378
|
+
end
|
379
|
+
|
380
|
+
if sm == "sched.models_present" then
|
381
|
+
before :each do
|
382
|
+
Facter::Util::Processor.stubs(:read_sched_models).returns(sched_models)
|
383
|
+
Facter.collection.internal_loader.load(:processor)
|
384
|
+
end
|
385
|
+
else
|
386
|
+
before :each do
|
387
|
+
Facter::Util::Processor.stubs(:read_sched_models).returns(nil)
|
388
|
+
Facter.collection.internal_loader.load(:processor)
|
389
|
+
end
|
390
|
+
end
|
391
|
+
|
392
|
+
%w{ 0 1 }.each do |j|
|
393
|
+
it "should find #{expected_cpu}" do
|
394
|
+
Facter.value("processor#{j}").should == expected_cpu
|
395
|
+
end
|
396
|
+
end
|
397
|
+
end
|
398
|
+
end
|
399
|
+
end
|
400
|
+
end
|
401
|
+
end
|