[DRE-commits] [vagrant-libvirt] 25/163: Update readme and test cases

Antonio Terceiro terceiro at moszumanska.debian.org
Sun Apr 24 13:57:00 UTC 2016


This is an automated email from the git hooks/post-receive script.

terceiro pushed a commit to annotated tag 0.0.26
in repository vagrant-libvirt.

commit eb1dab013145510d04703bfb54d45012f371e1e5
Author: Nico Tonozzi <nico.tonozzi at sendgrid.com>
Date:   Tue Aug 5 09:16:52 2014 -0600

    Update readme and test cases
    
    Updated documentation so that users could find the new option.
    
    Updated test case to behave as expected.
---
 README.md                                              | 1 +
 lib/vagrant-libvirt/action/set_name_of_domain.rb       | 3 ++-
 spec/support/environment_helper.rb                     | 8 ++------
 spec/vagrant-libvirt/action/set_name_of_domain_spec.rb | 3 ++-
 4 files changed, 7 insertions(+), 8 deletions(-)

diff --git a/README.md b/README.md
index ab3293f..8e23fbd 100644
--- a/README.md
+++ b/README.md
@@ -148,6 +148,7 @@ end
 * `volume_cache` - Controls the cache mechanism. Possible values are "default", "none", "writethrough", "writeback", "directsync" and "unsafe". [See driver->cache in libvirt documentation](http://libvirt.org/formatdomain.html#elementsDisks).
 * `kernel` - To launch the guest with a kernel residing on host filesystems. Equivalent to qemu `-kernel`.
 * `initrd` - To specify the initramfs/initrd to use for the guest. Equivalent to qemu `-initrd`.
+* `random_hostname` - To create a domain name with with extra information on the end to prevent hostname conflicts.
 * `cmd_line` - Arguments passed on to the guest kernel initramfs or initrd to use. Equivalent to qemu `-append`.
 
 
diff --git a/lib/vagrant-libvirt/action/set_name_of_domain.rb b/lib/vagrant-libvirt/action/set_name_of_domain.rb
index e7dba96..9d91ea7 100644
--- a/lib/vagrant-libvirt/action/set_name_of_domain.rb
+++ b/lib/vagrant-libvirt/action/set_name_of_domain.rb
@@ -35,7 +35,8 @@ module VagrantPlugins
         end
 
         # build domain name
-        # avoids `domain about to create is already taken`
+        # random_hostname option avoids
+        # `domain about to create is already taken`
         # parsable and sortable by epoch time
         # @example
         #   development-centos-6-chef-11_1404488971_3b7a569e2fd7c554b852
diff --git a/spec/support/environment_helper.rb b/spec/support/environment_helper.rb
index 7a4cf70..f49db85 100644
--- a/spec/support/environment_helper.rb
+++ b/spec/support/environment_helper.rb
@@ -3,9 +3,9 @@ require "pathname"
 
 class EnvironmentHelper
 
-  attr_writer :default_prefix, :domain_name
+  attr_writer :domain_name
 
-  attr_accessor :random_hostname, :name
+  attr_accessor :random_hostname, :name, :default_prefix
 
   def [](value)
     self.send(value.to_sym)
@@ -19,10 +19,6 @@ class EnvironmentHelper
     self
   end
 
-  def default_prefix
-    # noop 
-  end
-
   def root_path
     Pathname.new("./spec/support/foo")
   end
diff --git a/spec/vagrant-libvirt/action/set_name_of_domain_spec.rb b/spec/vagrant-libvirt/action/set_name_of_domain_spec.rb
index 4847c75..69d3319 100644
--- a/spec/vagrant-libvirt/action/set_name_of_domain_spec.rb
+++ b/spec/vagrant-libvirt/action/set_name_of_domain_spec.rb
@@ -14,7 +14,8 @@ describe VagrantPlugins::ProviderLibvirt::Action::SetNameOfDomain do
   end
 
   it "builds simple domain name" do
+    @env.default_prefix= 'pre'
     dmn = VagrantPlugins::ProviderLibvirt::Action::SetNameOfDomain.new(Object.new, @env)
-    dmn.build_domain_name(@env).should eq("foo_") 
+    dmn.build_domain_name(@env).should eq('pre_') 
   end
 end

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-ruby-extras/vagrant-libvirt.git



More information about the Pkg-ruby-extras-commits mailing list