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,180 @@
|
|
1
|
+
require 'facter/util/posix'
|
2
|
+
require 'facter/util/file_read'
|
3
|
+
require 'pathname'
|
4
|
+
|
5
|
+
module Facter::Util::Virtual
|
6
|
+
##
|
7
|
+
# virt_what is a delegating helper method intended to make it easier to stub
|
8
|
+
# the system call without affecting other calls to
|
9
|
+
# Facter::Core::Execution.exec
|
10
|
+
#
|
11
|
+
# Per https://bugzilla.redhat.com/show_bug.cgi?id=719611 when run as a
|
12
|
+
# non-root user the virt-what command may emit an error message on stdout,
|
13
|
+
# and later versions of virt-what may emit this message on stderr. This
|
14
|
+
# method ensures stderr is redirected and that error messages are stripped
|
15
|
+
# from stdout.
|
16
|
+
def self.virt_what(command = "virt-what")
|
17
|
+
command = Facter::Core::Execution.which(command)
|
18
|
+
return unless command
|
19
|
+
|
20
|
+
if Facter.value(:kernel) == 'windows'
|
21
|
+
redirected_cmd = "#{command} 2>NUL"
|
22
|
+
else
|
23
|
+
redirected_cmd = "#{command} 2>/dev/null"
|
24
|
+
end
|
25
|
+
output = Facter::Core::Execution.exec redirected_cmd
|
26
|
+
output.gsub(/^virt-what: .*$/, '') if output
|
27
|
+
end
|
28
|
+
|
29
|
+
##
|
30
|
+
# lspci is a delegating helper method intended to make it easier to stub the
|
31
|
+
# system call without affecting other calls to Facter::Core::Execution.exec
|
32
|
+
def self.lspci(command = "lspci 2>/dev/null")
|
33
|
+
Facter::Core::Execution.exec command
|
34
|
+
end
|
35
|
+
|
36
|
+
def self.openvz?
|
37
|
+
FileTest.directory?("/proc/vz") and not self.openvz_cloudlinux?
|
38
|
+
end
|
39
|
+
|
40
|
+
# So one can either have #6728 work on OpenVZ or Cloudlinux. Whoo.
|
41
|
+
def self.openvz_type
|
42
|
+
return false unless self.openvz?
|
43
|
+
return false unless FileTest.exists?( '/proc/self/status' )
|
44
|
+
|
45
|
+
envid = Facter::Core::Execution.exec( 'grep "envID" /proc/self/status' )
|
46
|
+
if envid =~ /^envID:\s+0$/i
|
47
|
+
return 'openvzhn'
|
48
|
+
elsif envid =~ /^envID:\s+(\d+)$/i
|
49
|
+
return 'openvzve'
|
50
|
+
end
|
51
|
+
end
|
52
|
+
|
53
|
+
# Cloudlinux uses OpenVZ to a degree, but always has an empty /proc/vz/ and
|
54
|
+
# has /proc/lve/list present
|
55
|
+
def self.openvz_cloudlinux?
|
56
|
+
FileTest.file?("/proc/lve/list") or Dir.glob('/proc/vz/*').empty?
|
57
|
+
end
|
58
|
+
|
59
|
+
def self.zone?
|
60
|
+
return true if FileTest.directory?("/.SUNWnative")
|
61
|
+
z = Facter::Core::Execution.exec("/sbin/zonename")
|
62
|
+
return false unless z
|
63
|
+
return z.chomp != 'global'
|
64
|
+
end
|
65
|
+
|
66
|
+
def self.vserver?
|
67
|
+
return false unless FileTest.exists?("/proc/self/status")
|
68
|
+
txt = File.open("/proc/self/status", "rb").read
|
69
|
+
if txt.respond_to?(:encode!)
|
70
|
+
txt.encode!('UTF-16', 'UTF-8', :invalid => :replace)
|
71
|
+
txt.encode!('UTF-8', 'UTF-16')
|
72
|
+
end
|
73
|
+
return true if txt =~ /^(s_context|VxID):[[:blank:]]*[0-9]/
|
74
|
+
return false
|
75
|
+
end
|
76
|
+
|
77
|
+
def self.vserver_type
|
78
|
+
if self.vserver?
|
79
|
+
if FileTest.exists?("/proc/virtual")
|
80
|
+
"vserver_host"
|
81
|
+
else
|
82
|
+
"vserver"
|
83
|
+
end
|
84
|
+
end
|
85
|
+
end
|
86
|
+
|
87
|
+
def self.xen?
|
88
|
+
["/proc/sys/xen", "/sys/bus/xen", "/proc/xen" ].detect do |f|
|
89
|
+
FileTest.exists?(f)
|
90
|
+
end
|
91
|
+
end
|
92
|
+
|
93
|
+
def self.kvm?
|
94
|
+
txt = if FileTest.exists?("/proc/cpuinfo")
|
95
|
+
File.read("/proc/cpuinfo")
|
96
|
+
elsif ["FreeBSD", "OpenBSD"].include? Facter.value(:kernel)
|
97
|
+
Facter::Util::POSIX.sysctl("hw.model")
|
98
|
+
end
|
99
|
+
(txt =~ /QEMU Virtual CPU/) ? true : false
|
100
|
+
end
|
101
|
+
|
102
|
+
def self.virtualbox?
|
103
|
+
File.read("/sys/devices/virtual/dmi/id/product_name") =~ /VirtualBox/ rescue false
|
104
|
+
end
|
105
|
+
|
106
|
+
def self.kvm_type
|
107
|
+
# TODO Tell the difference between kvm and qemu
|
108
|
+
# Can't work out a way to do this at the moment that doesn't
|
109
|
+
# require a special binary
|
110
|
+
if self.kvm?
|
111
|
+
"kvm"
|
112
|
+
end
|
113
|
+
end
|
114
|
+
|
115
|
+
def self.rhev?
|
116
|
+
File.read("/sys/devices/virtual/dmi/id/product_name") =~ /RHEV Hypervisor/ rescue false
|
117
|
+
end
|
118
|
+
|
119
|
+
def self.ovirt?
|
120
|
+
File.read("/sys/devices/virtual/dmi/id/product_name") =~ /oVirt Node/ rescue false
|
121
|
+
end
|
122
|
+
|
123
|
+
def self.gce?
|
124
|
+
File.read("/sys/devices/virtual/dmi/id/product_name") =~ /Google/ rescue false
|
125
|
+
end
|
126
|
+
|
127
|
+
def self.jail?
|
128
|
+
path = case Facter.value(:kernel)
|
129
|
+
when "FreeBSD" then "/sbin"
|
130
|
+
when "GNU/kFreeBSD" then "/bin"
|
131
|
+
end
|
132
|
+
Facter::Core::Execution.exec("#{path}/sysctl -n security.jail.jailed") == "1"
|
133
|
+
end
|
134
|
+
|
135
|
+
def self.hpvm?
|
136
|
+
Facter::Core::Execution.exec("/usr/bin/getconf MACHINE_MODEL").chomp =~ /Virtual Machine/
|
137
|
+
end
|
138
|
+
|
139
|
+
##
|
140
|
+
# lxc? returns true if the process is running inside of a linux container.
|
141
|
+
# Implementation derived from
|
142
|
+
# http://stackoverflow.com/questions/20010199/determining-if-a-process-runs-inside-lxc-docker
|
143
|
+
def self.lxc?
|
144
|
+
path = Pathname.new('/proc/1/cgroup')
|
145
|
+
return false unless path.readable?
|
146
|
+
in_lxc = path.readlines.any? {|l| l.split(":")[2].to_s.start_with? '/lxc/' }
|
147
|
+
return true if in_lxc
|
148
|
+
return false
|
149
|
+
end
|
150
|
+
|
151
|
+
##
|
152
|
+
# docker? returns true if the process is running inside of a docker container.
|
153
|
+
# Implementation derived from observation of a boot2docker system
|
154
|
+
def self.docker?
|
155
|
+
path = Pathname.new('/proc/1/cgroup')
|
156
|
+
return false unless path.readable?
|
157
|
+
in_docker = path.readlines.any? {|l| l.split(":")[2].to_s.start_with? '/docker/' }
|
158
|
+
return true if in_docker
|
159
|
+
return false
|
160
|
+
end
|
161
|
+
|
162
|
+
def self.zlinux?
|
163
|
+
"zlinux"
|
164
|
+
end
|
165
|
+
|
166
|
+
##
|
167
|
+
# read_sysfs Reads the raw data as per the documentation at [Detecting if You
|
168
|
+
# Are Running in Google Compute
|
169
|
+
# Engine](https://developers.google.com/compute/docs/instances#dmi) This
|
170
|
+
# method is intended to provide an easy seam to mock.
|
171
|
+
#
|
172
|
+
# @api public
|
173
|
+
#
|
174
|
+
# @return [String] or nil if the path does not exist or is unreadable
|
175
|
+
def self.read_sysfs_dmi_entries(path="/sys/firmware/dmi/entries/1-0/raw")
|
176
|
+
if File.readable?(path)
|
177
|
+
Facter::Util::FileRead.read_binary(path)
|
178
|
+
end
|
179
|
+
end
|
180
|
+
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
# A module to gather vlan facts
|
2
|
+
#
|
3
|
+
module Facter::Util::Vlans
|
4
|
+
def self.get_vlan_config
|
5
|
+
if File.exist?('/proc/net/vlan/config') and File.readable?('/proc/net/vlan/config')
|
6
|
+
File.read('/proc/net/vlan/config')
|
7
|
+
end
|
8
|
+
end
|
9
|
+
|
10
|
+
def self.get_vlans
|
11
|
+
if (config = self.get_vlan_config)
|
12
|
+
vlans = []
|
13
|
+
config.each_line do |line|
|
14
|
+
if (match = line.match(/^([0-9A-Za-z]+)\.([0-9]+) /))
|
15
|
+
vlans << match[2] if match[2]
|
16
|
+
end
|
17
|
+
end
|
18
|
+
vlans.join(',') unless vlans.empty?
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
module Facter::Util::WMI
|
2
|
+
class << self
|
3
|
+
def connect(uri = wmi_resource_uri)
|
4
|
+
require 'win32ole'
|
5
|
+
WIN32OLE.connect(uri)
|
6
|
+
end
|
7
|
+
|
8
|
+
def wmi_resource_uri( host = '.' )
|
9
|
+
"winmgmts:{impersonationLevel=impersonate}!//#{host}/root/cimv2"
|
10
|
+
end
|
11
|
+
|
12
|
+
def execquery(query)
|
13
|
+
connect().execquery(query)
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
@@ -0,0 +1,10 @@
|
|
1
|
+
# A module to gather running Xen Domains
|
2
|
+
#
|
3
|
+
module Facter::Util::Xendomains
|
4
|
+
def self.get_domains
|
5
|
+
if xm_list = Facter::Core::Execution.exec('/usr/sbin/xm list 2>/dev/null')
|
6
|
+
domains = xm_list.split("\n").reject { |line| line =~ /^(Name|Domain-0)/ }
|
7
|
+
domains.map { |line| line.split(/\s/)[0] }.join(',')
|
8
|
+
end
|
9
|
+
end
|
10
|
+
end
|
@@ -0,0 +1,86 @@
|
|
1
|
+
module Facter
|
2
|
+
if not defined? FACTERVERSION then
|
3
|
+
FACTERVERSION = '2.1.0'
|
4
|
+
end
|
5
|
+
|
6
|
+
# Returns the running version of Facter.
|
7
|
+
#
|
8
|
+
# @comment The intent is that software external to Facter be able to
|
9
|
+
# determine the Facter version with no side-effects. The expected
|
10
|
+
# use is:
|
11
|
+
#
|
12
|
+
# require 'facter/version'
|
13
|
+
# version = Facter.version
|
14
|
+
#
|
15
|
+
# This function has the following ordering precedence. This precedence list
|
16
|
+
# is designed to facilitate automated packaging tasks by simply writing to
|
17
|
+
# the VERSION file in the same directory as this source file.
|
18
|
+
#
|
19
|
+
# 1. If a version has been explicitly assigned using the Facter.version=
|
20
|
+
# method, return that version.
|
21
|
+
# 2. If there is a VERSION file, read the contents, trim any
|
22
|
+
# trailing whitespace, and return that version string.
|
23
|
+
# 3. Return the value of the Facter::FACTERVERSION constant hard-coded into
|
24
|
+
# the source code.
|
25
|
+
#
|
26
|
+
# If there is no VERSION file, the method must return the version string of
|
27
|
+
# the nearest parent version that is an officially released version. That is
|
28
|
+
# to say, if a branch named 3.1.x contains 25 patches on top of the most
|
29
|
+
# recent official release of 3.1.1, then the version method must return the
|
30
|
+
# string "3.1.1" if no "VERSION" file is present.
|
31
|
+
#
|
32
|
+
# By design the version identifier is _not_ intended to vary during the life of
|
33
|
+
# a process. There is no guarantee provided that writing to the VERSION file
|
34
|
+
# while a Puppet process is running will cause the version string to be
|
35
|
+
# updated. On the contrary, the contents of the VERSION are cached to reduce
|
36
|
+
# filesystem accesses.
|
37
|
+
#
|
38
|
+
# The VERSION file is intended to be used by package maintainers who may be
|
39
|
+
# applying patches or otherwise changing the software version in a manner
|
40
|
+
# that warrants a different software version identifier. The VERSION file is
|
41
|
+
# intended to be managed and owned by the release process and packaging
|
42
|
+
# related tasks, and as such should not reside in version control. The
|
43
|
+
# FACTERVERSION constant is intended to be version controlled in history.
|
44
|
+
#
|
45
|
+
# Ideally, this behavior will allow package maintainers to precisely specify
|
46
|
+
# the version of the software they're packaging as in the following example:
|
47
|
+
#
|
48
|
+
# $ git describe > lib/facter/VERSION
|
49
|
+
# $ ruby -r facter -e 'puts Facter.version'
|
50
|
+
# 1.6.14-6-g66f2c99
|
51
|
+
#
|
52
|
+
# @api public
|
53
|
+
#
|
54
|
+
# @return [String] containing the facter version, e.g. "1.6.14"
|
55
|
+
def self.version
|
56
|
+
version_file = File.join(File.dirname(__FILE__), 'VERSION')
|
57
|
+
return @facter_version if @facter_version
|
58
|
+
if version = read_version_file(version_file)
|
59
|
+
@facter_version = version
|
60
|
+
end
|
61
|
+
@facter_version ||= FACTERVERSION
|
62
|
+
end
|
63
|
+
|
64
|
+
# Sets the Facter version
|
65
|
+
#
|
66
|
+
# @return [void]
|
67
|
+
#
|
68
|
+
# @api private
|
69
|
+
def self.version=(version)
|
70
|
+
@facter_version = version
|
71
|
+
end
|
72
|
+
|
73
|
+
# This reads the content of the "VERSION" file that lives in the
|
74
|
+
# same directory as this source code file.
|
75
|
+
#
|
76
|
+
# @api private
|
77
|
+
#
|
78
|
+
# @return [String] the version -- for example: "1.6.14-6-gea42046" or nil if the VERSION
|
79
|
+
# file does not exist.
|
80
|
+
def self.read_version_file(path)
|
81
|
+
if File.exists?(path)
|
82
|
+
File.read(path).chomp
|
83
|
+
end
|
84
|
+
end
|
85
|
+
private_class_method :read_version_file
|
86
|
+
end
|
@@ -0,0 +1,311 @@
|
|
1
|
+
# Fact: virtual
|
2
|
+
#
|
3
|
+
# Purpose: Determine if the system's hardware is real or virtualised.
|
4
|
+
#
|
5
|
+
# Resolution:
|
6
|
+
# Assumes physical unless proven otherwise.
|
7
|
+
#
|
8
|
+
# On Darwin, use the macosx util module to acquire the SPHardwareDataType and
|
9
|
+
# SPEthernetDataType, from which it is possible to determine if the host is a
|
10
|
+
# VMware, Parallels, or VirtualBox. This previously used SPDisplaysDataType
|
11
|
+
# which was not reliable if running headless, and also caused lagging issues
|
12
|
+
# on actual Macs.
|
13
|
+
#
|
14
|
+
# On Linux, BSD, Solaris and HPUX:
|
15
|
+
# Much of the logic here is obscured behind util/virtual.rb, which rather
|
16
|
+
# than document here, which would encourage drift, just refer to it.
|
17
|
+
# The Xen tests in here rely on /sys and /proc, and check for the presence and
|
18
|
+
# contents of files in there.
|
19
|
+
# If after all the other tests, it's still seen as physical, then it tries to
|
20
|
+
# parse the output of the "lspci", "dmidecode" and "prtdiag" and parses them
|
21
|
+
# for obvious signs of being under VMware, Parallels or VirtualBox.
|
22
|
+
# Finally it checks for the existence of vmware-vmx, which would hint it's
|
23
|
+
# VMware.
|
24
|
+
#
|
25
|
+
# Caveats:
|
26
|
+
# Many checks rely purely on existence of files.
|
27
|
+
#
|
28
|
+
|
29
|
+
require 'facter/util/virtual'
|
30
|
+
|
31
|
+
Facter.add("virtual") do
|
32
|
+
confine :kernel => "Darwin"
|
33
|
+
|
34
|
+
setcode do
|
35
|
+
require 'facter/util/macosx'
|
36
|
+
result = "physical"
|
37
|
+
# use SPHardwareDataType for VMware and VirtualBox, since it is the most
|
38
|
+
# reliable source.
|
39
|
+
output = Facter::Util::Macosx.profiler_data("SPHardwareDataType")
|
40
|
+
if output.is_a?(Hash)
|
41
|
+
result = "vmware" if output["machine_model"] =~ /VMware/
|
42
|
+
result = "virtualbox" if output["boot_rom_version"] =~ /VirtualBox/
|
43
|
+
end
|
44
|
+
# Parallels passes through almost all of the host's hardware info to the
|
45
|
+
# virtual machine, so use a different field.
|
46
|
+
output = Facter::Util::Macosx.profiler_data("SPEthernetDataType")
|
47
|
+
if output.is_a?(Hash)
|
48
|
+
result = "parallels" if output["spethernet_subsystem-vendor-id"] =~ /0x1ab8/
|
49
|
+
end
|
50
|
+
result
|
51
|
+
end
|
52
|
+
end
|
53
|
+
|
54
|
+
Facter.add("virtual") do
|
55
|
+
confine :kernel => ["FreeBSD", "GNU/kFreeBSD"]
|
56
|
+
has_weight 10
|
57
|
+
setcode do
|
58
|
+
"jail" if Facter::Util::Virtual.jail?
|
59
|
+
end
|
60
|
+
end
|
61
|
+
|
62
|
+
Facter.add("virtual") do
|
63
|
+
confine :kernel => 'SunOS'
|
64
|
+
has_weight 10
|
65
|
+
self.timeout = 6
|
66
|
+
|
67
|
+
setcode do
|
68
|
+
next "zone" if Facter::Util::Virtual.zone?
|
69
|
+
|
70
|
+
output = Facter::Core::Execution.exec('prtdiag')
|
71
|
+
if output
|
72
|
+
lines = output.split("\n")
|
73
|
+
next "parallels" if lines.any? {|l| l =~ /Parallels/ }
|
74
|
+
next "vmware" if lines.any? {|l| l =~ /VM[wW]are/ }
|
75
|
+
next "virtualbox" if lines.any? {|l| l =~ /VirtualBox/ }
|
76
|
+
next "xenhvm" if lines.any? {|l| l =~ /HVM domU/ }
|
77
|
+
end
|
78
|
+
end
|
79
|
+
end
|
80
|
+
|
81
|
+
Facter.add("virtual") do
|
82
|
+
confine :kernel => 'HP-UX'
|
83
|
+
has_weight 10
|
84
|
+
setcode do
|
85
|
+
"hpvm" if Facter::Util::Virtual.hpvm?
|
86
|
+
end
|
87
|
+
end
|
88
|
+
|
89
|
+
Facter.add("virtual") do
|
90
|
+
confine :architecture => 's390x'
|
91
|
+
has_weight 10
|
92
|
+
setcode do
|
93
|
+
"zlinux" if Facter::Util::Virtual.zlinux?
|
94
|
+
end
|
95
|
+
end
|
96
|
+
|
97
|
+
Facter.add("virtual") do
|
98
|
+
confine :kernel => 'OpenBSD'
|
99
|
+
has_weight 10
|
100
|
+
setcode do
|
101
|
+
output = Facter::Util::POSIX.sysctl("hw.product")
|
102
|
+
if output
|
103
|
+
lines = output.split("\n")
|
104
|
+
next "parallels" if lines.any? {|l| l =~ /Parallels/ }
|
105
|
+
next "vmware" if lines.any? {|l| l =~ /VMware/ }
|
106
|
+
next "virtualbox" if lines.any? {|l| l =~ /VirtualBox/ }
|
107
|
+
next "xenhvm" if lines.any? {|l| l =~ /HVM domU/ }
|
108
|
+
next "ovirt" if lines.any? {|l| l =~ /oVirt Node/ }
|
109
|
+
end
|
110
|
+
end
|
111
|
+
end
|
112
|
+
|
113
|
+
Facter.add("virtual") do
|
114
|
+
confine :kernel => %w{Linux FreeBSD OpenBSD SunOS HP-UX GNU/kFreeBSD}
|
115
|
+
|
116
|
+
setcode do
|
117
|
+
next Facter::Util::Virtual.openvz_type if Facter::Util::Virtual.openvz?
|
118
|
+
next Facter::Util::Virtual.vserver_type if Facter::Util::Virtual.vserver?
|
119
|
+
|
120
|
+
if Facter::Util::Virtual.xen?
|
121
|
+
next "xen0" if FileTest.exists?("/dev/xen/evtchn")
|
122
|
+
next "xenu" if FileTest.exists?("/proc/xen")
|
123
|
+
end
|
124
|
+
|
125
|
+
next "virtualbox" if Facter::Util::Virtual.virtualbox?
|
126
|
+
next Facter::Util::Virtual.kvm_type if Facter::Util::Virtual.kvm?
|
127
|
+
next "rhev" if Facter::Util::Virtual.rhev?
|
128
|
+
next "ovirt" if Facter::Util::Virtual.ovirt?
|
129
|
+
|
130
|
+
# Parse lspci
|
131
|
+
output = Facter::Util::Virtual.lspci
|
132
|
+
if output
|
133
|
+
lines = output.split("\n")
|
134
|
+
next "vmware" if lines.any? {|l| l =~ /VM[wW]are/ }
|
135
|
+
next "virtualbox" if lines.any? {|l| l =~ /VirtualBox/ }
|
136
|
+
next "parallels" if lines.any? {|l| l =~ /1ab8:|[Pp]arallels/ }
|
137
|
+
next "xenhvm" if lines.any? {|l| l =~ /XenSource/ }
|
138
|
+
next "hyperv" if lines.any? {|l| l =~ /Microsoft Corporation Hyper-V/ }
|
139
|
+
next "gce" if lines.any? {|l| l =~ /Class 8007: Google, Inc/ }
|
140
|
+
end
|
141
|
+
|
142
|
+
# Parse dmidecode
|
143
|
+
output = Facter::Core::Execution.exec('dmidecode 2> /dev/null')
|
144
|
+
if output
|
145
|
+
lines = output.split("\n")
|
146
|
+
next "parallels" if lines.any? {|l| l =~ /Parallels/ }
|
147
|
+
next "vmware" if lines.any? {|l| l =~ /VMware/ }
|
148
|
+
next "virtualbox" if lines.any? {|l| l =~ /VirtualBox/ }
|
149
|
+
next "xenhvm" if lines.any? {|l| l =~ /HVM domU/ }
|
150
|
+
next "hyperv" if lines.any? {|l| l =~ /Product Name: Virtual Machine/ }
|
151
|
+
next "rhev" if lines.any? {|l| l =~ /Product Name: RHEV Hypervisor/ }
|
152
|
+
next "ovirt" if lines.any? {|l| l =~ /Product Name: oVirt Node/ }
|
153
|
+
end
|
154
|
+
|
155
|
+
# Default to 'physical'
|
156
|
+
next 'physical'
|
157
|
+
end
|
158
|
+
end
|
159
|
+
|
160
|
+
Facter.add("virtual") do
|
161
|
+
confine do
|
162
|
+
Facter::Core::Execution.which('vmware')
|
163
|
+
end
|
164
|
+
|
165
|
+
setcode do
|
166
|
+
# Sample output of vmware -v `VMware Server 1.0.5 build-80187`
|
167
|
+
output = Facter::Core::Execution.exec("vmware -v")
|
168
|
+
if output
|
169
|
+
mdata = output.match /(\S+)\s+(\S+)/
|
170
|
+
next "#{mdata[1]}_#{mdata[2]}".downcase if mdata
|
171
|
+
end
|
172
|
+
end
|
173
|
+
end
|
174
|
+
|
175
|
+
Facter.add("virtual") do
|
176
|
+
confine :kernel => "windows"
|
177
|
+
setcode do
|
178
|
+
require 'facter/util/wmi'
|
179
|
+
result = nil
|
180
|
+
Facter::Util::WMI.execquery("SELECT manufacturer, model FROM Win32_ComputerSystem").each do |computersystem|
|
181
|
+
case computersystem.model
|
182
|
+
when /VirtualBox/
|
183
|
+
result = "virtualbox"
|
184
|
+
when /Virtual Machine/
|
185
|
+
result = "hyperv" if computersystem.manufacturer =~ /Microsoft/
|
186
|
+
when /VMware/
|
187
|
+
result = "vmware"
|
188
|
+
when /KVM/
|
189
|
+
result = "kvm"
|
190
|
+
when /Bochs/
|
191
|
+
result = "bochs"
|
192
|
+
end
|
193
|
+
|
194
|
+
if result.nil? and computersystem.manufacturer =~ /Xen/
|
195
|
+
result = "xen"
|
196
|
+
end
|
197
|
+
|
198
|
+
break
|
199
|
+
end
|
200
|
+
result ||= "physical"
|
201
|
+
|
202
|
+
result
|
203
|
+
end
|
204
|
+
end
|
205
|
+
|
206
|
+
##
|
207
|
+
# virtual fact based on virt-what command.
|
208
|
+
#
|
209
|
+
# The output is mapped onto existing known values for the virtual fact in an
|
210
|
+
# effort to preserve consistency. This fact has a high weight becuase the
|
211
|
+
# virt-what tool is expected to be maintained upstream.
|
212
|
+
#
|
213
|
+
# If the virt-what command is not available, this fact will not resolve to a
|
214
|
+
# value and lower-weight virtual facts will be attempted.
|
215
|
+
#
|
216
|
+
# Only the last line of the virt-what command is returned
|
217
|
+
Facter.add("virtual") do
|
218
|
+
has_weight 500
|
219
|
+
|
220
|
+
setcode do
|
221
|
+
if output = Facter::Util::Virtual.virt_what
|
222
|
+
case output
|
223
|
+
when 'linux_vserver'
|
224
|
+
Facter::Util::Virtual.vserver_type
|
225
|
+
when /xen-hvm/i
|
226
|
+
'xenhvm'
|
227
|
+
when /xen-dom0/i
|
228
|
+
'xen0'
|
229
|
+
when /xen-domU/i
|
230
|
+
'xenu'
|
231
|
+
when /ibm_systemz/i
|
232
|
+
'zlinux'
|
233
|
+
else
|
234
|
+
output.to_s.split("\n").last
|
235
|
+
end
|
236
|
+
end
|
237
|
+
end
|
238
|
+
end
|
239
|
+
|
240
|
+
##
|
241
|
+
# virtual fact specific to Google Compute Engine's Linux sysfs entry.
|
242
|
+
Facter.add("virtual") do
|
243
|
+
has_weight 600
|
244
|
+
confine :kernel => "Linux"
|
245
|
+
|
246
|
+
setcode do
|
247
|
+
if dmi_data = Facter::Util::Virtual.read_sysfs_dmi_entries
|
248
|
+
case dmi_data
|
249
|
+
when /Google/
|
250
|
+
"gce"
|
251
|
+
end
|
252
|
+
end
|
253
|
+
end
|
254
|
+
end
|
255
|
+
|
256
|
+
##
|
257
|
+
# virtual fact specific to linux containers. This also works for Docker
|
258
|
+
# containers running in lxc.
|
259
|
+
Facter.add("virtual") do
|
260
|
+
has_weight 700
|
261
|
+
confine :kernel => "Linux"
|
262
|
+
|
263
|
+
setcode do
|
264
|
+
"lxc" if Facter::Util::Virtual.lxc?
|
265
|
+
end
|
266
|
+
end
|
267
|
+
|
268
|
+
##
|
269
|
+
# virtual fact specific to docker containers.
|
270
|
+
Facter.add("virtual") do
|
271
|
+
has_weight 750
|
272
|
+
confine :kernel => "Linux"
|
273
|
+
|
274
|
+
setcode do
|
275
|
+
"docker" if Facter::Util::Virtual.docker?
|
276
|
+
end
|
277
|
+
end
|
278
|
+
|
279
|
+
Facter.add("virtual") do
|
280
|
+
has_weight 600
|
281
|
+
confine :kernel => "Linux"
|
282
|
+
|
283
|
+
setcode do
|
284
|
+
"gce" if Facter::Util::Virtual.gce?
|
285
|
+
end
|
286
|
+
end
|
287
|
+
|
288
|
+
# Fact: is_virtual
|
289
|
+
#
|
290
|
+
# Purpose: returning true or false for if a machine is virtualised or not.
|
291
|
+
#
|
292
|
+
# Resolution: Hypervisors and the like may be detected as a virtual type, but
|
293
|
+
# are not actual virtual machines, or should not be treated as such. This
|
294
|
+
# determines if the host is actually virtualized.
|
295
|
+
#
|
296
|
+
# Caveats:
|
297
|
+
#
|
298
|
+
|
299
|
+
Facter.add("is_virtual") do
|
300
|
+
confine :kernel => %w{Linux FreeBSD OpenBSD SunOS HP-UX Darwin GNU/kFreeBSD windows}
|
301
|
+
|
302
|
+
setcode do
|
303
|
+
physical_types = %w{physical xen0 vmware_server vmware_workstation openvzhn vserver_host}
|
304
|
+
|
305
|
+
if physical_types.include? Facter.value(:virtual)
|
306
|
+
"false"
|
307
|
+
else
|
308
|
+
"true"
|
309
|
+
end
|
310
|
+
end
|
311
|
+
end
|