vagrant-vsphere 0.15.0 → 0.16.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
 - data/.bumpversion.cfg +1 -1
 - data/README.md +4 -2
 - data/lib/vSphere/action/clone.rb +7 -1
 - data/lib/vSphere/config.rb +1 -0
 - data/lib/vSphere/version.rb +1 -1
 - data/spec/clone_spec.rb +18 -4
 - data/spec/spec_helper.rb +2 -1
 - metadata +2 -2
 
    
        checksums.yaml
    CHANGED
    
    | 
         @@ -1,7 +1,7 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            ---
         
     | 
| 
       2 
2 
     | 
    
         
             
            SHA1:
         
     | 
| 
       3 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       4 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 3 
     | 
    
         
            +
              metadata.gz: 86bbc3afad22bc9be46d1ea266be3eb020251f29
         
     | 
| 
      
 4 
     | 
    
         
            +
              data.tar.gz: 576d495fee241d31b5954b1bb55886bc7438b7e4
         
     | 
| 
       5 
5 
     | 
    
         
             
            SHA512:
         
     | 
| 
       6 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       7 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 6 
     | 
    
         
            +
              metadata.gz: 8f62c938f26de6ef905bf1d97899ff095630c4c165bd328ec8c9d6f2d7a1dafad4ace951cca5b4fd23c173936b89d23c9e285917b9f5d44593704395b95d48fc
         
     | 
| 
      
 7 
     | 
    
         
            +
              data.tar.gz: f0a47dd6662ea81107f5a64761b5416933310739613dd19140de3416d37524f19c27c74a9b0b959dfee5ea1264ab11d54c854fc416763acd48e6f65f8f1e475d
         
     | 
    
        data/.bumpversion.cfg
    CHANGED
    
    
    
        data/README.md
    CHANGED
    
    | 
         @@ -12,9 +12,9 @@ This provider is built on top of the [RbVmomi](https://github.com/vmware/rbvmomi 
     | 
|
| 
       12 
12 
     | 
    
         
             
            * libxml2, libxml2-dev, libxslt, libxslt-dev
         
     | 
| 
       13 
13 
     | 
    
         | 
| 
       14 
14 
     | 
    
         
             
            ## Current Version
         
     | 
| 
       15 
     | 
    
         
            -
            **version: 0. 
     | 
| 
      
 15 
     | 
    
         
            +
            **version: 0.16.0**
         
     | 
| 
       16 
16 
     | 
    
         | 
| 
       17 
     | 
    
         
            -
            vagrant-vsphere (**version: 0. 
     | 
| 
      
 17 
     | 
    
         
            +
            vagrant-vsphere (**version: 0.16.0**) is available from [RubyGems.org](https://rubygems.org/gems/vagrant-vsphere)
         
     | 
| 
       18 
18 
     | 
    
         | 
| 
       19 
19 
     | 
    
         
             
            ## Installation
         
     | 
| 
       20 
20 
     | 
    
         | 
| 
         @@ -101,6 +101,7 @@ This provider has the following settings, all are required unless noted: 
     | 
|
| 
       101 
101 
     | 
    
         
             
            * `proxy_host` - _Optional_ proxy host name for connecting to vSphere via proxy
         
     | 
| 
       102 
102 
     | 
    
         
             
            * `proxy_port` - _Optional_ proxy port number for connecting to vSphere via proxy
         
     | 
| 
       103 
103 
     | 
    
         
             
            * `vlan` - _Optional_ vlan to connect the first NIC to
         
     | 
| 
      
 104 
     | 
    
         
            +
            * `memory_mb` - _Optional_ Configure the amount of memory (in MB) for the new VM
         
     | 
| 
       104 
105 
     | 
    
         | 
| 
       105 
106 
     | 
    
         
             
            ### Cloning from a VM rather than a template
         
     | 
| 
       106 
107 
     | 
    
         | 
| 
         @@ -192,6 +193,7 @@ This is useful if running Vagrant from multiple directories or if multiple machi 
     | 
|
| 
       192 
193 
     | 
    
         
             
              * If the VM is powered on, then it is powered off, and destroyed.
         
     | 
| 
       193 
194 
     | 
    
         
             
              * If the VM is powered off, it is just destroyed.
         
     | 
| 
       194 
195 
     | 
    
         
             
              * If the VM is suspended, it is powered on, then powered off, then destroyed.
         
     | 
| 
      
 196 
     | 
    
         
            +
            * 0.16.0 Add ability to configure amount of memory the new cloned VM will have [#94 rylarson:add-memory-configuration](https://github.com/nsidc/vagrant-vsphere/pull/94).
         
     | 
| 
       195 
197 
     | 
    
         | 
| 
       196 
198 
     | 
    
         | 
| 
       197 
199 
     | 
    
         
             
            ## Versioning
         
     | 
    
        data/lib/vSphere/action/clone.rb
    CHANGED
    
    | 
         @@ -28,10 +28,12 @@ module VagrantPlugins 
     | 
|
| 
       28 
28 
     | 
    
         
             
                      begin
         
     | 
| 
       29 
29 
     | 
    
         
             
                        location = get_location connection, machine, config, template
         
     | 
| 
       30 
30 
     | 
    
         
             
                        spec = RbVmomi::VIM.VirtualMachineCloneSpec :location => location, :powerOn => true, :template => false
         
     | 
| 
      
 31 
     | 
    
         
            +
                        spec[:config] = RbVmomi::VIM.VirtualMachineConfigSpec
         
     | 
| 
       31 
32 
     | 
    
         
             
                        customization_info = get_customization_spec_info_by_name connection, machine
         
     | 
| 
       32 
33 
     | 
    
         | 
| 
       33 
34 
     | 
    
         
             
                        spec[:customization] = get_customization_spec(machine, customization_info) unless customization_info.nil?
         
     | 
| 
       34 
35 
     | 
    
         
             
                        add_custom_vlan(template, dc, spec, config.vlan) unless config.vlan.nil?
         
     | 
| 
      
 36 
     | 
    
         
            +
                        add_custom_memory(spec, config.memory_mb) unless config.memory_mb.nil?
         
     | 
| 
       35 
37 
     | 
    
         | 
| 
       36 
38 
     | 
    
         
             
                        env[:ui].info I18n.t('vsphere.creating_cloned_vm')
         
     | 
| 
       37 
39 
     | 
    
         
             
                        env[:ui].info " -- #{config.clone_from_vm ? "Source" : "Template"} VM: #{template.pretty_path}"
         
     | 
| 
         @@ -137,7 +139,7 @@ module VagrantPlugins 
     | 
|
| 
       137 
139 
     | 
    
         
             
                    end
         
     | 
| 
       138 
140 
     | 
    
         | 
| 
       139 
141 
     | 
    
         
             
                    def add_custom_vlan(template, dc, spec, vlan)
         
     | 
| 
       140 
     | 
    
         
            -
                      spec[:config] 
     | 
| 
      
 142 
     | 
    
         
            +
                      spec[:config][:deviceChange] = []
         
     | 
| 
       141 
143 
     | 
    
         
             
                      network = get_network_by_name(dc, vlan)
         
     | 
| 
       142 
144 
     | 
    
         
             
                      config = template.config
         
     | 
| 
       143 
145 
     | 
    
         
             
                      card = config.hardware.device.grep(RbVmomi::VIM::VirtualEthernetCard).first or fail Errors::VSphereError, :missing_network_card
         
     | 
| 
         @@ -151,6 +153,10 @@ module VagrantPlugins 
     | 
|
| 
       151 
153 
     | 
    
         
             
                      dev_spec = RbVmomi::VIM.VirtualDeviceConfigSpec(:device => card, :operation => "edit")
         
     | 
| 
       152 
154 
     | 
    
         
             
                      spec[:config][:deviceChange].push dev_spec
         
     | 
| 
       153 
155 
     | 
    
         
             
                    end
         
     | 
| 
      
 156 
     | 
    
         
            +
             
     | 
| 
      
 157 
     | 
    
         
            +
                    def add_custom_memory(spec, memory_mb)
         
     | 
| 
      
 158 
     | 
    
         
            +
                      spec[:config][:memoryMB] = Integer(memory_mb)
         
     | 
| 
      
 159 
     | 
    
         
            +
                    end
         
     | 
| 
       154 
160 
     | 
    
         
             
                  end
         
     | 
| 
       155 
161 
     | 
    
         
             
                end
         
     | 
| 
       156 
162 
     | 
    
         
             
              end
         
     | 
    
        data/lib/vSphere/config.rb
    CHANGED
    
    
    
        data/lib/vSphere/version.rb
    CHANGED
    
    
    
        data/spec/clone_spec.rb
    CHANGED
    
    | 
         @@ -12,7 +12,8 @@ describe VagrantPlugins::VSphere::Action::Clone do 
     | 
|
| 
       12 
12 
     | 
    
         
             
                expect(@template).to have_received(:CloneVM_Task).with({
         
     | 
| 
       13 
13 
     | 
    
         
             
                  :folder => @data_center,
         
     | 
| 
       14 
14 
     | 
    
         
             
                  :name => NAME,
         
     | 
| 
       15 
     | 
    
         
            -
                  :spec => {:location => {:pool => @child_resource_pool}  
     | 
| 
      
 15 
     | 
    
         
            +
                  :spec => {:location => {:pool => @child_resource_pool}, 
         
     | 
| 
      
 16 
     | 
    
         
            +
                    :config => RbVmomi::VIM.VirtualMachineConfigSpec }
         
     | 
| 
       16 
17 
     | 
    
         
             
                })
         
     | 
| 
       17 
18 
     | 
    
         
             
              end
         
     | 
| 
       18 
19 
     | 
    
         | 
| 
         @@ -25,7 +26,8 @@ describe VagrantPlugins::VSphere::Action::Clone do 
     | 
|
| 
       25 
26 
     | 
    
         
             
                expect(@template).to have_received(:CloneVM_Task).with({
         
     | 
| 
       26 
27 
     | 
    
         
             
                  :folder => custom_base_folder,
         
     | 
| 
       27 
28 
     | 
    
         
             
                  :name => NAME,
         
     | 
| 
       28 
     | 
    
         
            -
                  :spec => {:location => {:pool => @child_resource_pool} 
     | 
| 
      
 29 
     | 
    
         
            +
                  :spec => {:location => {:pool => @child_resource_pool},
         
     | 
| 
      
 30 
     | 
    
         
            +
                    :config => RbVmomi::VIM.VirtualMachineConfigSpec }
         
     | 
| 
       29 
31 
     | 
    
         
             
                })
         
     | 
| 
       30 
32 
     | 
    
         
             
              end
         
     | 
| 
       31 
33 
     | 
    
         | 
| 
         @@ -55,11 +57,22 @@ describe VagrantPlugins::VSphere::Action::Clone do 
     | 
|
| 
       55 
57 
     | 
    
         
             
                  :name => NAME,
         
     | 
| 
       56 
58 
     | 
    
         
             
                  :spec => {:location => 
         
     | 
| 
       57 
59 
     | 
    
         
             
                    {:pool => @child_resource_pool},
         
     | 
| 
       58 
     | 
    
         
            -
             
     | 
| 
      
 60 
     | 
    
         
            +
                      :config => expected_config
         
     | 
| 
       59 
61 
     | 
    
         
             
                  }
         
     | 
| 
       60 
62 
     | 
    
         
             
                })
         
     | 
| 
       61 
63 
     | 
    
         
             
              end
         
     | 
| 
       62 
64 
     | 
    
         | 
| 
      
 65 
     | 
    
         
            +
              it 'should create a CloneVM spec with configured memory_mb' do
         
     | 
| 
      
 66 
     | 
    
         
            +
                @machine.provider_config.stub(:memory_mb).and_return(2048)
         
     | 
| 
      
 67 
     | 
    
         
            +
                call
         
     | 
| 
      
 68 
     | 
    
         
            +
                expect(@template).to have_received(:CloneVM_Task).with({
         
     | 
| 
      
 69 
     | 
    
         
            +
                  :folder => @data_center,
         
     | 
| 
      
 70 
     | 
    
         
            +
                  :name => NAME,
         
     | 
| 
      
 71 
     | 
    
         
            +
                  :spec => {:location => {:pool => @child_resource_pool}, 
         
     | 
| 
      
 72 
     | 
    
         
            +
                    :config => RbVmomi::VIM.VirtualMachineConfigSpec(:memoryMB => 2048) },
         
     | 
| 
      
 73 
     | 
    
         
            +
                })
         
     | 
| 
      
 74 
     | 
    
         
            +
              end
         
     | 
| 
      
 75 
     | 
    
         
            +
             
     | 
| 
       63 
76 
     | 
    
         
             
              it 'should set static IP when given config spec' do
         
     | 
| 
       64 
77 
     | 
    
         
             
                @machine.provider_config.stub(:customization_spec_name).and_return('spec')
         
     | 
| 
       65 
78 
     | 
    
         
             
                call
         
     | 
| 
         @@ -72,7 +85,8 @@ describe VagrantPlugins::VSphere::Action::Clone do 
     | 
|
| 
       72 
85 
     | 
    
         
             
                expect(@template).to have_received(:CloneVM_Task).with({
         
     | 
| 
       73 
86 
     | 
    
         
             
                  :folder => @data_center,
         
     | 
| 
       74 
87 
     | 
    
         
             
                  :name => NAME,
         
     | 
| 
       75 
     | 
    
         
            -
                  :spec => {:location => {:pool => @root_resource_pool }  
     | 
| 
      
 88 
     | 
    
         
            +
                  :spec => {:location => {:pool => @root_resource_pool }, 
         
     | 
| 
      
 89 
     | 
    
         
            +
                    :config => RbVmomi::VIM.VirtualMachineConfigSpec }
         
     | 
| 
       76 
90 
     | 
    
         
             
                })
         
     | 
| 
       77 
91 
     | 
    
         
             
              end
         
     | 
| 
       78 
92 
     | 
    
         
             
            end
         
     | 
    
        data/spec/spec_helper.rb
    CHANGED
    
    
    
        metadata
    CHANGED
    
    | 
         @@ -1,14 +1,14 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            --- !ruby/object:Gem::Specification
         
     | 
| 
       2 
2 
     | 
    
         
             
            name: vagrant-vsphere
         
     | 
| 
       3 
3 
     | 
    
         
             
            version: !ruby/object:Gem::Version
         
     | 
| 
       4 
     | 
    
         
            -
              version: 0. 
     | 
| 
      
 4 
     | 
    
         
            +
              version: 0.16.0
         
     | 
| 
       5 
5 
     | 
    
         
             
            platform: ruby
         
     | 
| 
       6 
6 
     | 
    
         
             
            authors:
         
     | 
| 
       7 
7 
     | 
    
         
             
            - Andrew Grauch
         
     | 
| 
       8 
8 
     | 
    
         
             
            autorequire: 
         
     | 
| 
       9 
9 
     | 
    
         
             
            bindir: bin
         
     | 
| 
       10 
10 
     | 
    
         
             
            cert_chain: []
         
     | 
| 
       11 
     | 
    
         
            -
            date: 2014- 
     | 
| 
      
 11 
     | 
    
         
            +
            date: 2014-10-01 00:00:00.000000000 Z
         
     | 
| 
       12 
12 
     | 
    
         
             
            dependencies:
         
     | 
| 
       13 
13 
     | 
    
         
             
            - !ruby/object:Gem::Dependency
         
     | 
| 
       14 
14 
     | 
    
         
             
              name: nokogiri
         
     |