Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

vm_list: show subfolder list when not recursing them

  • Loading branch information...
commit 56582f81a868492eaffe13efb7e36db0e7323c64 1 parent 25126c4
@jcam jcam authored
Showing with 8 additions and 0 deletions.
  1. +8 −0 lib/chef/knife/vsphere_vm_list.rb
View
8 lib/chef/knife/vsphere_vm_list.rb
@@ -37,6 +37,13 @@ def print_vms_in_folder(folder)
end
end
+ def print_subfolders(folder)
+ folders = find_all_in_folder(folder, RbVmomi::VIM::Folder)
+ folders.each do |subfolder|
+ puts "#{ui.color("Folder Name", :cyan)}: #{subfolder.name}"
+ end
+ end
+
def run
$stdout.sync = true
vim = get_vim_connection
@@ -44,6 +51,7 @@ def run
if config[:recursive]
traverse_folders(baseFolder)
else
+ print_subfolders(baseFolder)
print_vms_in_folder(baseFolder)
end
end
Please sign in to comment.
Something went wrong with that request. Please try again.