require 'spec_helper' describe "role::custom_windows" do context "using fact set CentOS-6.6-32" do node_facts = {"architecture"=>"i386", "augeas"=>{"version"=>"1.4.0"}, "augeasversion"=>"1.4.0", "bios_release_date"=>"12/01/2006", "bios_vendor"=>"innotek GmbH", "bios_version"=>"VirtualBox", "blockdevice_sda_model"=>"VBOX HARDDISK", "blockdevice_sda_size"=>0, "blockdevice_sda_vendor"=>"ATA", "blockdevices"=>"sda", "boardmanufacturer"=>"Oracle Corporation", "boardproductname"=>"VirtualBox", "boardserialnumber"=>"0", "chassistype"=>"Other", "concat_basedir"=>"/opt/puppetlabs/puppet/cache/concat", "dhcp_servers"=>{"eth0"=>"10.0.2.2", "system"=>"10.0.2.2"}, "disks"=>{"sda"=>{"model"=>"VBOX HARDDISK", "size"=>"20.00 GiB", "size_bytes"=>0, "vendor"=>"ATA"}}, "dmi"=>{"bios"=>{"release_date"=>"12/01/2006", "vendor"=>"innotek GmbH", "version"=>"VirtualBox"}, "board"=>{"manufacturer"=>"Oracle Corporation", "product"=>"VirtualBox", "serial_number"=>"0"}, "chassis"=>{"type"=>"Other"}, "manufacturer"=>"innotek GmbH", "product"=>{"name"=>"VirtualBox", "serial_number"=>"0", "uuid"=>"6C33275E-3132-4167-9318-9BDE31E82035"}}, "domain"=>"wifredrick.local", "facterversion"=>"3.0.2", "filesystems"=>"ext4,iso9660", "fqdn"=>"localhost.wifredrick.local", "gid"=>"root", "hardwareisa"=>"i686", "hardwaremodel"=>"i686", "hostname"=>"localhost", "id"=>"root", "identity"=>{"gid"=>0, "group"=>"root", "uid"=>0, "user"=>"root"}, "interfaces"=>"eth0,lo", "ipaddress"=>"10.0.2.15", "ipaddress6"=>"fe80::a00:27ff:feff:42e5", "ipaddress6_eth0"=>"fe80::a00:27ff:feff:42e5", "ipaddress6_lo"=>"::1", "ipaddress_eth0"=>"10.0.2.15", "ipaddress_lo"=>"127.0.0.1", "is_virtual"=>true, "kernel"=>"Linux", "kernelmajversion"=>"2.6", "kernelrelease"=>"2.6.32-504.el6.i686", "kernelversion"=>"2.6.32", "load_averages"=>{"15m"=>0.0, "1m"=>0.0, "5m"=>0.0}, "macaddress"=>"08:00:27:ff:42:e5", "macaddress_eth0"=>"08:00:27:ff:42:e5", "manufacturer"=>"innotek GmbH", "memory"=>{"swap"=>{"available"=>"1.00 GiB", "available_bytes"=>1073737728, "capacity"=>"0%", "total"=>"1.00 GiB", "total_bytes"=>1073737728, "used"=>"0 bytes", "used_bytes"=>0}, "system"=>{"available"=>"451.91 MiB", "available_bytes"=>473862144, "capacity"=>"9.40%", "total"=>"498.82 MiB", "total_bytes"=>523051008, "used"=>"46.91 MiB", "used_bytes"=>49188864}}, "memoryfree"=>"451.91 MiB", "memoryfree_mb"=>451.91015625, "memorysize"=>"498.82 MiB", "memorysize_mb"=>498.8203125, "mountpoints"=>{"/"=>{"available"=>"1.02 GiB", "available_bytes"=>1099689984, "capacity"=>"51.05%", "device"=>"/dev/mapper/VolGroup-lv_root", "filesystem"=>"ext4", "options"=>["rw"], "size"=>"2.09 GiB", "size_bytes"=>-2048442368, "used"=>"1.07 GiB", "used_bytes"=>1146834944}, "/boot"=>{"available"=>"450.39 MiB", "available_bytes"=>472266752, "capacity"=>"5.42%", "device"=>"/dev/sda1", "filesystem"=>"ext4", "options"=>["rw"], "size"=>"476.22 MiB", "size_bytes"=>499355648, "used"=>"25.83 MiB", "used_bytes"=>27088896}}, "mtu_eth0"=>1500, "mtu_lo"=>65536, "netmask"=>"255.255.255.0", "netmask6"=>"ffff:ffff:ffff:ffff::", "netmask6_eth0"=>"ffff:ffff:ffff:ffff::", "netmask6_lo"=>"ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff", "netmask_eth0"=>"255.255.255.0", "netmask_lo"=>"255.0.0.0", "network"=>"10.0.2.0", "network6"=>"fe80::", "network6_eth0"=>"fe80::", "network6_lo"=>"::1", "network_eth0"=>"10.0.2.0", "network_lo"=>"127.0.0.0", "networking"=>{"dhcp"=>"10.0.2.2", "domain"=>"wifredrick.local", "fqdn"=>"localhost.wifredrick.local", "hostname"=>"localhost", "interfaces"=>{"eth0"=>{"dhcp"=>"10.0.2.2", "ip"=>"10.0.2.15", "ip6"=>"fe80::a00:27ff:feff:42e5", "mac"=>"08:00:27:ff:42:e5", "mtu"=>1500, "netmask"=>"255.255.255.0", "netmask6"=>"ffff:ffff:ffff:ffff::", "network"=>"10.0.2.0", "network6"=>"fe80::"}, "lo"=>{"ip"=>"127.0.0.1", "ip6"=>"::1", "mtu"=>65536, "netmask"=>"255.0.0.0", "netmask6"=>"ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff", "network"=>"127.0.0.0", "network6"=>"::1"}}, "ip"=>"10.0.2.15", "ip6"=>"fe80::a00:27ff:feff:42e5", "mac"=>"08:00:27:ff:42:e5", "mtu"=>1500, "netmask"=>"255.255.255.0", "netmask6"=>"ffff:ffff:ffff:ffff::", "network"=>"10.0.2.0", "network6"=>"fe80::"}, "operatingsystem"=>"CentOS", "operatingsystemmajrelease"=>"6", "operatingsystemrelease"=>"6.6", "os"=>{"architecture"=>"i386", "family"=>"RedHat", "hardware"=>"i686", "name"=>"CentOS", "release"=>{"full"=>"6.6", "major"=>"6", "minor"=>"6"}, "selinux"=>{"enabled"=>false}}, "osfamily"=>"RedHat", "partitions"=>{"/dev/mapper/VolGroup-lv_root"=>{"filesystem"=>"ext4", "mount"=>"/", "size"=>"0 bytes", "size_bytes"=>0, "uuid"=>"bc353fb2-82b1-4d41-a43e-6512030a2a28"}, "/dev/mapper/VolGroup-lv_swap"=>{"filesystem"=>"swap", "size"=>"0 bytes", "size_bytes"=>0, "uuid"=>"eb19f39e-a1cc-4e43-bf33-809fa7f52044"}, "/dev/sda1"=>{"filesystem"=>"ext4", "mount"=>"/boot", "size"=>"500.00 MiB", "size_bytes"=>524288000, "uuid"=>"51727e98-6cd5-4fba-8a1f-7d4dfb575e1f"}, "/dev/sda2"=>{"filesystem"=>"LVM2_member", "size"=>"19.51 GiB", "size_bytes"=>-525336576, "uuid"=>"vkG7sJ-bfu3-Cko3-YJ7v-jPys-3uHe-vki0jZ"}}, "path"=>"/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/opt/puppetlabs/bin:/root/bin", "physicalprocessorcount"=>1, "processor0"=>"Intel(R) Core(TM) i7-4850HQ CPU @ 2.30GHz", "processorcount"=>1, "processors"=>{"count"=>1, "isa"=>"i686", "models"=>["Intel(R) Core(TM) i7-4850HQ CPU @ 2.30GHz"], "physicalcount"=>1}, "productname"=>"VirtualBox", "puppetversion"=>"4.2.1", "ruby"=>{"platform"=>"i686-linux", "sitedir"=>"/opt/puppetlabs/puppet/lib/ruby/site_ruby/2.1.0", "version"=>"2.1.6"}, "rubyplatform"=>"i686-linux", "rubysitedir"=>"/opt/puppetlabs/puppet/lib/ruby/site_ruby/2.1.0", "rubyversion"=>"2.1.6", "selinux"=>false, "serialnumber"=>"0", "ssh"=>{"dsa"=>{"fingerprints"=>{"sha1"=>"SSHFP 2 1 5c44d0a9f52668fbaaf05e6957f058d90264adfe", "sha256"=>"SSHFP 2 2 de1d70753fc8dcce901b997fca065a08cdfcc9d7ba44f630e0e16be7a54df877"}, "key"=>"AAAAB3NzaC1kc3MAAACBAME6dtbuRJGNiBgp3QqD50a8LmJLduCTsifX5ST6RA5l+LHIx/UpCo66dsSY29mXVsMIK6tlZyu0MDR4iOz/4oFcKwkgHvbZ33WFY7G526IDrszdLdWnEqxPw7pUC+izWmD337K0gcZnDMJGZk1PVEjK6i5MeFYI4SwYkdd/m7DTAAAAFQCzZLb3M4+Y0TBLUVImfxc31+KXiQAAAIAbk33qNmIiB4+iHJ0coB4MfSdwoPnhU+vG7XpqiA0W/68U6lGIFFFHW0R1utZUQ28E8jUhSwzM0EGXtiSyFpTzjAnS44UiIWvulTkbpa9RnTn1gVzR2Tpbc24LMiKqiz/ZrvKmp8jLUO1/BPCmD80yNXXo+v59wXnVD8Yak4u07QAAAIB0lpeV5gShABSEIBXBuAPGW67mjCdUqbj6Ry1ZV3XTPtUXWVhCehWQrPh9yYCItpepKWp55t7neSqVjaxFo7W8O2gBkYwv24eQiqaqI8vgV3fJf4mdb10cdAb6IzM46WVhSxo1al2XPLBDVtx1z/4RH/7agKpbfmP6QrDgKkMKow=="}, "rsa"=>{"fingerprints"=>{"sha1"=>"SSHFP 1 1 d1002ff7e5e42c3c9c9681d65afe0f195277d2a8", "sha256"=>"SSHFP 1 2 ac639861032637e9c24f0af7126242086540c3d1f41640576c011d6eb9f4bf24"}, "key"=>"AAAAB3NzaC1yc2EAAAABIwAAAQEArd8ro8164ykLYynBWxSiPBNUy1hLeh2S284vuYCbJwNC/naFBmcXORUFIsegfJpRxFKg3YsCbQUrHfZ6cfAc/xKUdoORUkF+8ixsVl4YzHg6vybxnRlaanBvS0eiR/wzxsVepqC/S3gd7YF3/Lca5sHNixNuqgxsd9iy9VEz7XMZ32mMxBqgTabR1KorBSufGMRADq/jauXpd2QRul+bih5uAL/Ilb2bZutcHUohnWi3UQnR10bO9MS1wr6c42VJBOHW6fZXvGjRvjd94AhNB7RTKvmRCucPCMvkgaDsr+z0cCjmpmptsdy119UpKmv4uCHalPbtHOWMYk2QVnqoQw=="}}, "sshdsakey"=>"AAAAB3NzaC1kc3MAAACBAME6dtbuRJGNiBgp3QqD50a8LmJLduCTsifX5ST6RA5l+LHIx/UpCo66dsSY29mXVsMIK6tlZyu0MDR4iOz/4oFcKwkgHvbZ33WFY7G526IDrszdLdWnEqxPw7pUC+izWmD337K0gcZnDMJGZk1PVEjK6i5MeFYI4SwYkdd/m7DTAAAAFQCzZLb3M4+Y0TBLUVImfxc31+KXiQAAAIAbk33qNmIiB4+iHJ0coB4MfSdwoPnhU+vG7XpqiA0W/68U6lGIFFFHW0R1utZUQ28E8jUhSwzM0EGXtiSyFpTzjAnS44UiIWvulTkbpa9RnTn1gVzR2Tpbc24LMiKqiz/ZrvKmp8jLUO1/BPCmD80yNXXo+v59wXnVD8Yak4u07QAAAIB0lpeV5gShABSEIBXBuAPGW67mjCdUqbj6Ry1ZV3XTPtUXWVhCehWQrPh9yYCItpepKWp55t7neSqVjaxFo7W8O2gBkYwv24eQiqaqI8vgV3fJf4mdb10cdAb6IzM46WVhSxo1al2XPLBDVtx1z/4RH/7agKpbfmP6QrDgKkMKow==", "sshfp_dsa"=>"SSHFP 2 1 5c44d0a9f52668fbaaf05e6957f058d90264adfe\nSSHFP 2 2 de1d70753fc8dcce901b997fca065a08cdfcc9d7ba44f630e0e16be7a54df877", "sshfp_rsa"=>"SSHFP 1 1 d1002ff7e5e42c3c9c9681d65afe0f195277d2a8\nSSHFP 1 2 ac639861032637e9c24f0af7126242086540c3d1f41640576c011d6eb9f4bf24", "sshrsakey"=>"AAAAB3NzaC1yc2EAAAABIwAAAQEArd8ro8164ykLYynBWxSiPBNUy1hLeh2S284vuYCbJwNC/naFBmcXORUFIsegfJpRxFKg3YsCbQUrHfZ6cfAc/xKUdoORUkF+8ixsVl4YzHg6vybxnRlaanBvS0eiR/wzxsVepqC/S3gd7YF3/Lca5sHNixNuqgxsd9iy9VEz7XMZ32mMxBqgTabR1KorBSufGMRADq/jauXpd2QRul+bih5uAL/Ilb2bZutcHUohnWi3UQnR10bO9MS1wr6c42VJBOHW6fZXvGjRvjd94AhNB7RTKvmRCucPCMvkgaDsr+z0cCjmpmptsdy119UpKmv4uCHalPbtHOWMYk2QVnqoQw==", "swapfree"=>"1.00 GiB", "swapfree_mb"=>1023.99609375, "swapsize"=>"1.00 GiB", "swapsize_mb"=>1023.99609375, "system_uptime"=>{"days"=>0, "hours"=>0, "seconds"=>430, "uptime"=>"0:07 hours"}, "timezone"=>"UTC", "uptime"=>"0:07 hours", "uptime_days"=>0, "uptime_hours"=>0, "uptime_seconds"=>430, "uuid"=>"6C33275E-3132-4167-9318-9BDE31E82035", "virtual"=>"virtualbox", "clientcert"=>"localhost.wifredrick.local", "clientversion"=>"4.2.1", "clientnoop"=>false} let(:facts) { node_facts } before :each do # Curtrently there is some code within Puppet that will try to execute # commands when compiling a catalog even though it shouldn't. One example is # the groups attribute of the user resource on AIX. If we are running on # Windows but pretending to be UNIX this will definitely fail so we need to # mock it (or vice versa) # Details: # https://github.com/puppetlabs/puppet/blob/master/lib/puppet/util/execution.rb#L191 expected_null_file = Puppet::Util::Platform.windows? ? 'NUL' : '/dev/null' unless File.exist? expected_null_file allow(Puppet::Util::Execution).to receive(:execute).and_raise(Puppet::ExecutionFailure.new("Onceover caused this")) end end let(:pre_condition) { pp = <<-'END' $onceover_class = 'role::custom_windows' $onceover_node = 'CentOS-6.6-32' # Begin user-specified pre_condition # End user-specified pre_condition END } it { should compile } end end