On 30 November 2010 19:10, Matt Robinson <m...@puppetlabs.com> wrote: > While looking at the patch for adding parallels to the virtual types > David Schmitt noticed that it might be easier just to list the types > that are NOT virtual since there's fewer of them.
+1 Paul > > Paired-with: Nick Lewis > > Signed-off-by: Matt Robinson <m...@puppetlabs.com> > --- > Local-branch: ticket/next/4754 > lib/facter/virtual.rb | 3 +-- > spec/unit/virtual.rb | 6 ++++++ > 2 files changed, 7 insertions(+), 2 deletions(-) > > diff --git a/lib/facter/virtual.rb b/lib/facter/virtual.rb > index a3b7163..8412a0a 100644 > --- a/lib/facter/virtual.rb > +++ b/lib/facter/virtual.rb > @@ -106,8 +106,7 @@ Facter.add("is_virtual") do > confine :kernel => %w{Linux FreeBSD OpenBSD SunOS HP-UX Darwin} > > setcode do > - case Facter.value(:virtual) > - when "xenu", "openvzve", "vmware", "kvm", "vserver", "jail", "zone", > "hpvm", "parallels" > + if Facter.value(:virtual) != "physical" && Facter.value(:virtual) != > "xen0" > "true" > else > "false" > diff --git a/spec/unit/virtual.rb b/spec/unit/virtual.rb > index d607960..9e8e358 100644 > --- a/spec/unit/virtual.rb > +++ b/spec/unit/virtual.rb > @@ -135,6 +135,12 @@ describe "is_virtual fact" do > Facter.fact(:is_virtual).value.should == "false" > end > > + it "should be false when running on physical" do > + Facter.fact(:kernel).stubs(:value).returns("Linux") > + Facter.fact(:virtual).stubs(:value).returns("physical") > + Facter.fact(:is_virtual).value.should == "false" > + end > + > it "should be true when running on vmware" do > Facter.fact(:kernel).stubs(:value).returns("Linux") > Facter.fact(:virtual).stubs(:value).returns("vmware") > -- > 1.7.3.1 > > -- > You received this message because you are subscribed to the Google Groups > "Puppet Developers" group. > To post to this group, send email to puppet-...@googlegroups.com. > To unsubscribe from this group, send email to > puppet-dev+unsubscr...@googlegroups.com. > For more options, visit this group at > http://groups.google.com/group/puppet-dev?hl=en. > > -- You received this message because you are subscribed to the Google Groups "Puppet Developers" group. To post to this group, send email to puppet-...@googlegroups.com. To unsubscribe from this group, send email to puppet-dev+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-dev?hl=en.