lib/chef/knife/profitbricks_volume_create.rb in knife-profitbricks-1.0.0 vs lib/chef/knife/profitbricks_volume_create.rb in knife-profitbricks-1.1.1
- old
+ new
@@ -9,21 +9,23 @@
option :datacenter_id,
short: '-D DATACENTER_UUID',
long: '--datacenter-id DATACENTER_UUID',
description: 'Name of the data center',
- proc: proc { |datacenter_id| Chef::Config[:knife][:datacenter_id] = datacenter_id }
+ proc: proc { |datacenter_id| Chef::Config[:knife][:datacenter_id] = datacenter_id },
+ required: true
option :name,
short: '-n NAME',
long: '--name NAME',
description: 'Name of the volume'
option :size,
short: '-S SIZE',
long: '--size SIZE',
- description: 'The size of the volume in GB'
+ description: 'The size of the volume in GB',
+ required: true
option :bus,
short: '-b BUS',
long: '--bus BUS',
description: 'The bus type of the volume (VIRTIO or IDE)'
@@ -34,17 +36,24 @@
description: 'The image or snapshot UUID'
option :type,
short: '-t TYPE',
long: '--type TYPE',
- description: 'The disk type; currently only HDD.'
+ description: 'The disk type; currently only HDD.',
+ required: true
option :licencetype,
short: '-l LICENCE',
long: '--licence-type LICENCE',
description: 'The licence type of the volume (LINUX, WINDOWS, UNKNOWN, OTHER)'
+ option :sshkeys,
+ short: '-K SSHKEY[,SSHKEY,...]',
+ long: '--ssh-keys SSHKEY1,SSHKEY2,...',
+ description: 'A list of public SSH keys to include',
+ proc: proc { |sshkeys| sshkeys.split(',') }
+
def run
$stdout.sync = true
print "#{ui.color('Creating volume...', :magenta)}"
@@ -52,20 +61,21 @@
name: config[:name],
size: config[:size],
bus: config[:bus] || 'VIRTIO',
image: config[:image],
type: config[:type],
- licenceType: config[:licencetype]
+ licenceType: config[:licencetype],
+ sshKeys: config[:sshkeys]
}
connection
volume = ProfitBricks::Volume.create(
config[:datacenter_id],
params.compact
)
dot = ui.color('.', :magenta)
- volume.wait_for { print dot; ready? }
+ volume.wait_for(300) { print dot; ready? }
volume.reload
puts "\n"
puts "#{ui.color('ID', :cyan)}: #{volume.id}"
puts "#{ui.color('Name', :cyan)}: #{volume.properties['name']}"