knife-vsphere 1.2.7 → 1.2.8
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
    CHANGED
    
    | 
         @@ -1,7 +1,7 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            ---
         
     | 
| 
       2 
2 
     | 
    
         
             
            SHA1:
         
     | 
| 
       3 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       4 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 3 
     | 
    
         
            +
              metadata.gz: 6e85bab504b011a44e58f635248bc9603285665b
         
     | 
| 
      
 4 
     | 
    
         
            +
              data.tar.gz: 45a6bea0b1737a6af5a09d692ce195d560a32ccc
         
     | 
| 
       5 
5 
     | 
    
         
             
            SHA512:
         
     | 
| 
       6 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       7 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 6 
     | 
    
         
            +
              metadata.gz: e7569807caee36f7cc4c36cec71f2d668c6fcc4f6a1ac865ef79869a6333cd8b70288dc9f0324c60dbe0999a7fc61d00784c70213b51be6e606b5702ba672f67
         
     | 
| 
      
 7 
     | 
    
         
            +
              data.tar.gz: 950c30592dbeca0397b08b4902b1a558bfa0f508dc977faa624f1fdded2bd3e32465a920e6674b7088c7945ae2cae8653e7d3b6cee90f6604ccc8a7ef2d5941a
         
     | 
| 
         @@ -558,8 +558,9 @@ class Chef::Knife::VsphereVmClone < Chef::Knife::BaseVsphereCommand 
     | 
|
| 
       558 
558 
     | 
    
         
             
                        fullName: cust_spec.identity.userData.fullName,
         
     | 
| 
       559 
559 
     | 
    
         
             
                        orgName: cust_spec.identity.userData.orgName,
         
     | 
| 
       560 
560 
     | 
    
         
             
                        productId: cust_spec.identity.userData.productId,
         
     | 
| 
       561 
     | 
    
         
            -
                        computerName:  
     | 
| 
      
 561 
     | 
    
         
            +
                        computerName: RbVmomi::VIM.CustomizationFixedName(name: hostname)
         
     | 
| 
       562 
562 
     | 
    
         
             
                      )
         
     | 
| 
      
 563 
     | 
    
         
            +
             
     | 
| 
       563 
564 
     | 
    
         
             
                      gui_unattended = RbVmomi::VIM.CustomizationGuiUnattended(
         
     | 
| 
       564 
565 
     | 
    
         
             
                        autoLogon: cust_spec.identity.guiUnattended.autoLogon,
         
     | 
| 
       565 
566 
     | 
    
         
             
                        autoLogonCount: cust_spec.identity.guiUnattended.autoLogonCount,
         
     | 
| 
         @@ -57,11 +57,11 @@ class Chef::Knife::VsphereVmMove < Chef::Knife::BaseVsphereCommand 
     | 
|
| 
       57 
57 
     | 
    
         | 
| 
       58 
58 
     | 
    
         
             
              # Move VM
         
     | 
| 
       59 
59 
     | 
    
         
             
              def move_vm(vm)
         
     | 
| 
       60 
     | 
    
         
            -
                dest_name = config[:dest_name] ||  
     | 
| 
      
 60 
     | 
    
         
            +
                dest_name = config[:dest_name] || vm.name
         
     | 
| 
       61 
61 
     | 
    
         
             
                dest_folder = config[:dest_folder].nil? ? (vm.parent) : (find_folder(get_config(:dest_folder)))
         
     | 
| 
       62 
62 
     | 
    
         | 
| 
       63 
     | 
    
         
            -
                vm.Rename_Task(newName: dest_name).wait_for_completion unless  
     | 
| 
       64 
     | 
    
         
            -
                dest_folder.MoveIntoFolder_Task(list: [vm]).wait_for_completion unless  
     | 
| 
      
 63 
     | 
    
         
            +
                vm.Rename_Task(newName: dest_name).wait_for_completion unless vm.name == dest_name
         
     | 
| 
      
 64 
     | 
    
         
            +
                dest_folder.MoveIntoFolder_Task(list: [vm]).wait_for_completion unless vm.parent == dest_folder
         
     | 
| 
       65 
65 
     | 
    
         
             
              end
         
     | 
| 
       66 
66 
     | 
    
         | 
| 
       67 
67 
     | 
    
         
             
              def run
         
     | 
| 
         @@ -84,5 +84,7 @@ class Chef::Knife::VsphereVmMove < Chef::Knife::BaseVsphereCommand 
     | 
|
| 
       84 
84 
     | 
    
         
             
                else
         
     | 
| 
       85 
85 
     | 
    
         
             
                  move_vm(vm)
         
     | 
| 
       86 
86 
     | 
    
         
             
                end
         
     | 
| 
      
 87 
     | 
    
         
            +
             
     | 
| 
      
 88 
     | 
    
         
            +
                puts "VM #{vm.name} moved successfully"
         
     | 
| 
       87 
89 
     | 
    
         
             
              end
         
     | 
| 
       88 
90 
     | 
    
         
             
            end
         
     | 
| 
         @@ -44,6 +44,19 @@ class Chef::Knife::VsphereVmSnapshot < Chef::Knife::BaseVsphereCommand 
     | 
|
| 
       44 
44 
     | 
    
         
             
                     description: 'Indicates whether to wait for creation/removal to complete',
         
     | 
| 
       45 
45 
     | 
    
         
             
                     boolean: false
         
     | 
| 
       46 
46 
     | 
    
         | 
| 
      
 47 
     | 
    
         
            +
              option :find,
         
     | 
| 
      
 48 
     | 
    
         
            +
                     long: '--find',
         
     | 
| 
      
 49 
     | 
    
         
            +
                     description: 'Finds the virtual machine by searching all folders'
         
     | 
| 
      
 50 
     | 
    
         
            +
             
     | 
| 
      
 51 
     | 
    
         
            +
              option :dump_memory,
         
     | 
| 
      
 52 
     | 
    
         
            +
                     long: '--dump-memory',
         
     | 
| 
      
 53 
     | 
    
         
            +
                     description: 'Dump the memory in the snapshot',
         
     | 
| 
      
 54 
     | 
    
         
            +
                     default: false
         
     | 
| 
      
 55 
     | 
    
         
            +
             
     | 
| 
      
 56 
     | 
    
         
            +
              option :quiesce,
         
     | 
| 
      
 57 
     | 
    
         
            +
                     long: '--quiesce',
         
     | 
| 
      
 58 
     | 
    
         
            +
                     description: 'Quiesce the VM prior to snapshotting',
         
     | 
| 
      
 59 
     | 
    
         
            +
                     default: false
         
     | 
| 
       47 
60 
     | 
    
         | 
| 
       48 
61 
     | 
    
         
             
              def run
         
     | 
| 
       49 
62 
     | 
    
         
             
                $stdout.sync = true
         
     | 
| 
         @@ -57,37 +70,45 @@ class Chef::Knife::VsphereVmSnapshot < Chef::Knife::BaseVsphereCommand 
     | 
|
| 
       57 
70 
     | 
    
         | 
| 
       58 
71 
     | 
    
         
             
                vim_connection
         
     | 
| 
       59 
72 
     | 
    
         | 
| 
       60 
     | 
    
         
            -
                 
     | 
| 
       61 
     | 
    
         
            -
             
     | 
| 
       62 
     | 
    
         
            -
             
     | 
| 
      
 73 
     | 
    
         
            +
                vm = if get_config(:find)
         
     | 
| 
      
 74 
     | 
    
         
            +
                       puts "No folder entered, searching for #{vmname}"
         
     | 
| 
      
 75 
     | 
    
         
            +
                       src_folder = find_folder(get_config(:folder))
         
     | 
| 
      
 76 
     | 
    
         
            +
                       traverse_folders_for_vm(src_folder, vmname)
         
     | 
| 
      
 77 
     | 
    
         
            +
                     else
         
     | 
| 
      
 78 
     | 
    
         
            +
                       base_folder = find_folder get_config(:folder)
         
     | 
| 
      
 79 
     | 
    
         
            +
                       find_in_folder(base_folder, RbVmomi::VIM::VirtualMachine, vmname) || abort("VM #{vmname} not found")
         
     | 
| 
      
 80 
     | 
    
         
            +
                     end
         
     | 
| 
       63 
81 
     | 
    
         | 
| 
       64 
82 
     | 
    
         
             
                if vm.snapshot
         
     | 
| 
       65 
83 
     | 
    
         
             
                  snapshot_list = vm.snapshot.rootSnapshotList
         
     | 
| 
       66 
84 
     | 
    
         
             
                  current_snapshot = vm.snapshot.currentSnapshot
         
     | 
| 
       67 
85 
     | 
    
         
             
                end
         
     | 
| 
       68 
86 
     | 
    
         | 
| 
       69 
     | 
    
         
            -
                if  
     | 
| 
      
 87 
     | 
    
         
            +
                if get_config(:list) && vm.snapshot
         
     | 
| 
       70 
88 
     | 
    
         
             
                  puts 'Current snapshot tree: '
         
     | 
| 
       71 
89 
     | 
    
         
             
                  puts "#{vmname}"
         
     | 
| 
       72 
90 
     | 
    
         
             
                  snapshot_list.each { |i| puts display_node(i, current_snapshot) }
         
     | 
| 
       73 
91 
     | 
    
         
             
                end
         
     | 
| 
       74 
92 
     | 
    
         | 
| 
       75 
     | 
    
         
            -
                if  
     | 
| 
       76 
     | 
    
         
            -
                  snapshot_task=vm.CreateSnapshot_Task(name:  
     | 
| 
       77 
     | 
    
         
            -
             
     | 
| 
      
 93 
     | 
    
         
            +
                if get_config(:create_new_snapshot)
         
     | 
| 
      
 94 
     | 
    
         
            +
                  snapshot_task = vm.CreateSnapshot_Task(name: get_config(:create_new_snapshot),
         
     | 
| 
      
 95 
     | 
    
         
            +
                                                         description: '',
         
     | 
| 
      
 96 
     | 
    
         
            +
                                                         memory: get_config(:dump_memory),
         
     | 
| 
      
 97 
     | 
    
         
            +
                                                         quiesce: get_config(:quiesce))
         
     | 
| 
      
 98 
     | 
    
         
            +
                  snapshot_task = snapshot_task.wait_for_completion if get_config(:wait)
         
     | 
| 
       78 
99 
     | 
    
         
             
                  snapshot_task
         
     | 
| 
       79 
100 
     | 
    
         
             
                end
         
     | 
| 
       80 
101 
     | 
    
         | 
| 
       81 
     | 
    
         
            -
                if  
     | 
| 
       82 
     | 
    
         
            -
                  ss_name =  
     | 
| 
      
 102 
     | 
    
         
            +
                if get_config(:remove_named_snapshot)
         
     | 
| 
      
 103 
     | 
    
         
            +
                  ss_name = get_config(:remove_named_snapshot)
         
     | 
| 
       83 
104 
     | 
    
         
             
                  snapshot = find_node(snapshot_list, ss_name)
         
     | 
| 
       84 
105 
     | 
    
         
             
                  puts "Found snapshot #{ss_name} removing."
         
     | 
| 
       85 
     | 
    
         
            -
                  snapshot_task=snapshot.RemoveSnapshot_Task(removeChildren: false)
         
     | 
| 
       86 
     | 
    
         
            -
                  snapshot_task=snapshot_task.wait_for_completion if  
     | 
| 
      
 106 
     | 
    
         
            +
                  snapshot_task = snapshot.RemoveSnapshot_Task(removeChildren: false)
         
     | 
| 
      
 107 
     | 
    
         
            +
                  snapshot_task = snapshot_task.wait_for_completion if get_config(:wait)
         
     | 
| 
       87 
108 
     | 
    
         
             
                  snapshot_task
         
     | 
| 
       88 
109 
     | 
    
         
             
                end
         
     | 
| 
       89 
110 
     | 
    
         | 
| 
       90 
     | 
    
         
            -
                if  
     | 
| 
      
 111 
     | 
    
         
            +
                if get_config(:revert_current_snapshot)
         
     | 
| 
       91 
112 
     | 
    
         
             
                  puts 'Reverting to Current Snapshot'
         
     | 
| 
       92 
113 
     | 
    
         
             
                  vm.RevertToCurrentSnapshot_Task(suppressPowerOn: false).wait_for_completion
         
     | 
| 
       93 
114 
     | 
    
         
             
                  if get_config(:power)
         
     | 
| 
         @@ -96,8 +117,8 @@ class Chef::Knife::VsphereVmSnapshot < Chef::Knife::BaseVsphereCommand 
     | 
|
| 
       96 
117 
     | 
    
         
             
                  end
         
     | 
| 
       97 
118 
     | 
    
         
             
                end
         
     | 
| 
       98 
119 
     | 
    
         | 
| 
       99 
     | 
    
         
            -
                return unless  
     | 
| 
       100 
     | 
    
         
            -
                ss_name =  
     | 
| 
      
 120 
     | 
    
         
            +
                return unless get_config(:revert_snapshot)
         
     | 
| 
      
 121 
     | 
    
         
            +
                ss_name = get_config(:revert_snapshot)
         
     | 
| 
       101 
122 
     | 
    
         
             
                snapshot = find_node(snapshot_list, ss_name)
         
     | 
| 
       102 
123 
     | 
    
         
             
                snapshot.RevertToSnapshot_Task(suppressPowerOn: false).wait_for_completion
         
     | 
| 
       103 
124 
     | 
    
         
             
                return unless get_config(:power)
         
     | 
    
        metadata
    CHANGED
    
    | 
         @@ -1,14 +1,14 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            --- !ruby/object:Gem::Specification
         
     | 
| 
       2 
2 
     | 
    
         
             
            name: knife-vsphere
         
     | 
| 
       3 
3 
     | 
    
         
             
            version: !ruby/object:Gem::Version
         
     | 
| 
       4 
     | 
    
         
            -
              version: 1.2. 
     | 
| 
      
 4 
     | 
    
         
            +
              version: 1.2.8
         
     | 
| 
       5 
5 
     | 
    
         
             
            platform: ruby
         
     | 
| 
       6 
6 
     | 
    
         
             
            authors:
         
     | 
| 
       7 
7 
     | 
    
         
             
            - Ezra Pagel
         
     | 
| 
       8 
8 
     | 
    
         
             
            autorequire: 
         
     | 
| 
       9 
9 
     | 
    
         
             
            bindir: bin
         
     | 
| 
       10 
10 
     | 
    
         
             
            cert_chain: []
         
     | 
| 
       11 
     | 
    
         
            -
            date: 2016- 
     | 
| 
      
 11 
     | 
    
         
            +
            date: 2016-03-22 00:00:00.000000000 Z
         
     | 
| 
       12 
12 
     | 
    
         
             
            dependencies:
         
     | 
| 
       13 
13 
     | 
    
         
             
            - !ruby/object:Gem::Dependency
         
     | 
| 
       14 
14 
     | 
    
         
             
              name: filesize
         
     |