knife-profitbricks 1.2.1 → 2.0.1

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.
Files changed (65) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +1 -0
  3. data/README.md +303 -96
  4. data/knife-profitbricks.gemspec +1 -1
  5. data/lib/chef/knife/profitbricks_base.rb +24 -0
  6. data/lib/chef/knife/profitbricks_composite_server_create.rb +59 -45
  7. data/lib/chef/knife/profitbricks_contract_list.rb +37 -0
  8. data/lib/chef/knife/profitbricks_datacenter_create.rb +8 -7
  9. data/lib/chef/knife/profitbricks_firewall_create.rb +15 -15
  10. data/lib/chef/knife/profitbricks_firewall_delete.rb +6 -8
  11. data/lib/chef/knife/profitbricks_firewall_list.rb +6 -5
  12. data/lib/chef/knife/profitbricks_ipblock_create.rb +6 -7
  13. data/lib/chef/knife/profitbricks_ipfailover_add.rb +60 -0
  14. data/lib/chef/knife/profitbricks_ipfailover_remove.rb +60 -0
  15. data/lib/chef/knife/profitbricks_lan_create.rb +5 -3
  16. data/lib/chef/knife/profitbricks_lan_list.rb +1 -1
  17. data/lib/chef/knife/profitbricks_nic_create.rb +12 -14
  18. data/lib/chef/knife/profitbricks_nic_delete.rb +4 -3
  19. data/lib/chef/knife/profitbricks_nic_list.rb +4 -3
  20. data/lib/chef/knife/profitbricks_server_create.rb +14 -16
  21. data/lib/chef/knife/profitbricks_server_delete.rb +1 -1
  22. data/lib/chef/knife/profitbricks_server_list.rb +1 -1
  23. data/lib/chef/knife/profitbricks_server_reboot.rb +1 -1
  24. data/lib/chef/knife/profitbricks_server_start.rb +1 -1
  25. data/lib/chef/knife/profitbricks_server_stop.rb +1 -1
  26. data/lib/chef/knife/profitbricks_volume_attach.rb +5 -5
  27. data/lib/chef/knife/profitbricks_volume_create.rb +38 -18
  28. data/lib/chef/knife/profitbricks_volume_delete.rb +1 -1
  29. data/lib/chef/knife/profitbricks_volume_detach.rb +4 -4
  30. data/lib/chef/knife/profitbricks_volume_list.rb +5 -6
  31. data/lib/knife-profitbricks/version.rb +1 -1
  32. data/spec/chef/knife/profitbricks_composite_server_create_spec.rb +64 -0
  33. data/spec/chef/knife/profitbricks_contract_list_spec.rb +20 -0
  34. data/spec/chef/knife/profitbricks_datacenter_create_spec.rb +44 -0
  35. data/spec/chef/knife/profitbricks_datacenter_delete_spec.rb +39 -0
  36. data/spec/chef/knife/profitbricks_datacenter_list_spec.rb +7 -6
  37. data/spec/chef/knife/profitbricks_firewall_create_spec.rb +74 -0
  38. data/spec/chef/knife/profitbricks_firewall_delete_spec.rb +86 -0
  39. data/spec/chef/knife/profitbricks_firewall_list_spec.rb +61 -0
  40. data/spec/chef/knife/profitbricks_image_list_spec.rb +19 -0
  41. data/spec/chef/knife/profitbricks_ipblock_create_spec.rb +39 -0
  42. data/spec/chef/knife/profitbricks_ipblock_delete_spec.rb +37 -0
  43. data/spec/chef/knife/profitbricks_ipfailover_add_spec.rb +80 -0
  44. data/spec/chef/knife/profitbricks_ipfailover_remove_spec.rb +85 -0
  45. data/spec/chef/knife/profitbricks_lan_create_spec.rb +59 -0
  46. data/spec/chef/knife/profitbricks_lan_delete_spec.rb +58 -0
  47. data/spec/chef/knife/profitbricks_lan_list_spec.rb +37 -0
  48. data/spec/chef/knife/profitbricks_location_list_spec.rb +24 -0
  49. data/spec/chef/knife/profitbricks_nic_create_spec.rb +71 -0
  50. data/spec/chef/knife/profitbricks_nic_delete_spec.rb +69 -0
  51. data/spec/chef/knife/profitbricks_nic_list_spec.rb +69 -0
  52. data/spec/chef/knife/profitbricks_server_create_spec.rb +63 -0
  53. data/spec/chef/knife/profitbricks_server_delete_spec.rb +63 -0
  54. data/spec/chef/knife/profitbricks_server_list_spec.rb +65 -0
  55. data/spec/chef/knife/profitbricks_server_reboot_spec.rb +65 -0
  56. data/spec/chef/knife/profitbricks_server_start_spec.rb +68 -0
  57. data/spec/chef/knife/profitbricks_server_stop_spec.rb +65 -0
  58. data/spec/chef/knife/profitbricks_volume_attach_spec.rb +70 -0
  59. data/spec/chef/knife/profitbricks_volume_create_spec.rb +63 -0
  60. data/spec/chef/knife/profitbricks_volume_delete_spec.rb +70 -0
  61. data/spec/chef/knife/profitbricks_volume_detach_spec.rb +81 -0
  62. data/spec/chef/knife/profitbricks_volume_list_spec.rb +80 -0
  63. data/spec/spec_helper.rb +22 -3
  64. data/spec/test.sh +1 -1
  65. metadata +81 -18
@@ -0,0 +1,60 @@
1
+ require 'chef/knife/profitbricks_base'
2
+
3
+ class Chef
4
+ class Knife
5
+ class ProfitbricksFailoverAdd < Knife
6
+ include Knife::ProfitbricksBase
7
+
8
+ banner 'knife profitbricks ipfailover add (options)'
9
+
10
+ option :datacenter_id,
11
+ short: '-D DATACENTER_ID',
12
+ long: '--datacenter-id DATACENTER_ID',
13
+ description: 'Name of the data center',
14
+ proc: proc { |datacenter_id| Chef::Config[:knife][:datacenter_id] = datacenter_id }
15
+
16
+ option :lan_id,
17
+ short: '-l LAN_ID',
18
+ long: '--lan-id LAN_ID',
19
+ description: 'Lan ID'
20
+ option :ip,
21
+ short: '-i',
22
+ long: '--ip',
23
+ description: 'IP to be added to IP failover group'
24
+
25
+ option :nic_id,
26
+ short: '-n',
27
+ long: '--nic-id',
28
+ description: 'NIC to be added to IP failover group'
29
+
30
+ def run
31
+ $stdout.sync = true
32
+ validate_required_params(%i[datacenter_id lan_id ip nic_id], Chef::Config[:knife])
33
+
34
+ connection
35
+
36
+ lan = ProfitBricks::LAN.get(Chef::Config[:knife][:datacenter_id], Chef::Config[:knife][:lan_id])
37
+
38
+ failover_ips = lan.properties[:ipFailover]
39
+ failover_ips ||= []
40
+ ip_failover = {}
41
+ ip_failover['ip'] = Chef::Config[:knife][:ip]
42
+ ip_failover['nicUuid'] = Chef::Config[:knife][:nic_id]
43
+
44
+ failover_ips.push(ip_failover)
45
+
46
+ lan.update(ipFailover: failover_ips)
47
+ lan.wait_for { ready? }
48
+ lan.reload
49
+
50
+ puts "\n"
51
+ puts "#{ui.color('ID', :cyan)}: #{lan.id}"
52
+ puts "#{ui.color('Name', :cyan)}: #{lan.properties['name']}"
53
+ puts "#{ui.color('Public', :cyan)}: #{lan.properties['public']}"
54
+ puts "#{ui.color('IP Failover', :cyan)}: #{lan.properties['ipFailover']}"
55
+
56
+ puts 'done'
57
+ end
58
+ end
59
+ end
60
+ end
@@ -0,0 +1,60 @@
1
+ require 'chef/knife/profitbricks_base'
2
+
3
+ class Chef
4
+ class Knife
5
+ class ProfitbricksFailoverRemove < Knife
6
+ include Knife::ProfitbricksBase
7
+
8
+ banner 'knife profitbricks ipfailover remove (options)'
9
+
10
+ option :datacenter_id,
11
+ short: '-D DATACENTER_ID',
12
+ long: '--datacenter-id DATACENTER_ID',
13
+ description: 'Name of the data center',
14
+ proc: proc { |datacenter_id| Chef::Config[:knife][:datacenter_id] = datacenter_id }
15
+
16
+ option :lan_id,
17
+ short: '-l LAN_ID',
18
+ long: '--lan-id LAN_ID',
19
+ description: 'Lan ID'
20
+ option :ip,
21
+ short: '-i',
22
+ long: '--ip',
23
+ description: 'IP to be removed from IP failover group'
24
+
25
+ option :nic_id,
26
+ short: '-n',
27
+ long: '--nic-id',
28
+ description: 'NIC to be removed from IP failover group'
29
+
30
+ def run
31
+ $stdout.sync = true
32
+ validate_required_params(%i[datacenter_id lan_id ip nic_id], Chef::Config[:knife])
33
+
34
+ connection
35
+
36
+ lan = ProfitBricks::LAN.get(Chef::Config[:knife][:datacenter_id], Chef::Config[:knife][:lan_id])
37
+
38
+ ipfailover = lan.properties['ipFailover']
39
+
40
+ ipfailover.each_with_index do |value, index|
41
+ if value['nicUuid'] == Chef::Config[:knife][:nic_id] && value['ip'] == Chef::Config[:knife][:ip]
42
+ ipfailover.delete_at(index)
43
+ end
44
+ end
45
+
46
+ lan.update(ipFailover: ipfailover)
47
+ lan.wait_for { ready? }
48
+ lan.reload
49
+
50
+ puts "\n"
51
+ puts "#{ui.color('ID', :cyan)}: #{lan.id}"
52
+ puts "#{ui.color('Name', :cyan)}: #{lan.properties['name']}"
53
+ puts "#{ui.color('Public', :cyan)}: #{lan.properties['public']}"
54
+ puts "#{ui.color('IP Failover', :cyan)}: #{lan.properties['ipFailover']}"
55
+
56
+ puts 'done'
57
+ end
58
+ end
59
+ end
60
+ end
@@ -26,16 +26,18 @@ class Chef
26
26
  description: 'Boolean indicating if the LAN faces the public ' \
27
27
  'Internet or not; defaults to false'
28
28
 
29
+
29
30
  def run
30
31
  $stdout.sync = true
32
+ validate_required_params(%i(datacenter_id), Chef::Config[:knife])
31
33
 
32
34
  print "#{ui.color('Creating LAN...', :magenta)}"
33
35
 
34
36
  connection
35
37
  lan = ProfitBricks::LAN.create(
36
- config[:datacenter_id],
37
- name: config[:name],
38
- public: config[:public]
38
+ Chef::Config[:knife][:datacenter_id],
39
+ name: Chef::Config[:knife][:name],
40
+ public: Chef::Config[:knife][:public]
39
41
  )
40
42
 
41
43
  dot = ui.color('.', :magenta)
@@ -22,7 +22,7 @@ class Chef
22
22
  ]
23
23
  connection
24
24
 
25
- ProfitBricks::LAN.list(config[:datacenter_id]).each do |lan|
25
+ ProfitBricks::LAN.list(Chef::Config[:knife][:datacenter_id]).each do |lan|
26
26
  lan_list << lan.id
27
27
  lan_list << lan.properties['name']
28
28
  lan_list << lan.properties['public'].to_s
@@ -16,8 +16,7 @@ class Chef
16
16
  option :server_id,
17
17
  short: '-S SERVER_ID',
18
18
  long: '--server-id SERVER_ID',
19
- description: 'Name of the server',
20
- required: true
19
+ description: 'Name of the server'
21
20
 
22
21
  option :name,
23
22
  short: '-n NAME',
@@ -40,35 +39,34 @@ class Chef
40
39
  option :lan,
41
40
  short: '-l ID',
42
41
  long: '--lan ID',
43
- description: 'The LAN ID the NIC will reside on; if the LAN ID does not exist it will be created',
44
- required: true
42
+ description: 'The LAN ID the NIC will reside on; if the LAN ID does not exist it will be created'
45
43
 
46
44
  option :nat,
47
45
  long: '--nat',
48
46
  boolean: true | false,
49
- description: 'Set to enable NAT on the NIC',
50
- required: false
47
+ description: 'Set to enable NAT on the NIC'
51
48
 
52
49
  def run
53
50
  $stdout.sync = true
51
+ validate_required_params(%i(datacenter_id server_id lan), Chef::Config[:knife])
54
52
 
55
53
  print "#{ui.color('Creating nic...', :magenta)}"
56
54
 
57
55
  params = {
58
- name: config[:name],
59
- ips: config[:ips],
60
- dhcp: config[:dhcp],
61
- lan: config[:lan]
56
+ name: Chef::Config[:knife][:name],
57
+ ips: Chef::Config[:knife][:ips],
58
+ dhcp: Chef::Config[:knife][:dhcp],
59
+ lan: Chef::Config[:knife][:lan]
62
60
  }
63
61
 
64
- if config[:nat]
65
- params[:nat] = config[:nat]
62
+ if Chef::Config[:knife][:nat]
63
+ params[:nat] = Chef::Config[:knife][:nat]
66
64
  end
67
65
 
68
66
  connection
69
67
  nic = ProfitBricks::NIC.create(
70
- config[:datacenter_id],
71
- config[:server_id],
68
+ Chef::Config[:knife][:datacenter_id],
69
+ Chef::Config[:knife][:server_id],
72
70
  params.compact
73
71
  )
74
72
 
@@ -16,14 +16,15 @@ class Chef
16
16
  option :server_id,
17
17
  short: '-S SERVER_ID',
18
18
  long: '--server-id SERVER_ID',
19
- description: 'The ID of the server assigned the NIC',
20
- required: true
19
+ description: 'The ID of the server assigned the NIC'
21
20
 
22
21
  def run
23
22
  connection
23
+ validate_required_params(%i(datacenter_id server_id), Chef::Config[:knife])
24
+
24
25
  @name_args.each do |nic_id|
25
26
  begin
26
- nic = ProfitBricks::NIC.get(config[:datacenter_id], config[:server_id], nic_id)
27
+ nic = ProfitBricks::NIC.get(Chef::Config[:knife][:datacenter_id], Chef::Config[:knife][:server_id], nic_id)
27
28
  rescue Excon::Errors::NotFound
28
29
  ui.error("NIC ID #{nic_id} not found. Skipping.")
29
30
  next
@@ -16,11 +16,12 @@ class Chef
16
16
  option :server_id,
17
17
  short: '-S SERVER_ID',
18
18
  long: '--server-id SERVER_ID',
19
- description: 'The ID of the server assigned the NIC',
20
- required: true
19
+ description: 'The ID of the server assigned the NIC'
21
20
 
22
21
  def run
23
22
  $stdout.sync = true
23
+ validate_required_params(%i(datacenter_id server_id), Chef::Config[:knife])
24
+
24
25
  nic_list = [
25
26
  ui.color('ID', :bold),
26
27
  ui.color('Name', :bold),
@@ -31,7 +32,7 @@ class Chef
31
32
  ]
32
33
  connection
33
34
 
34
- ProfitBricks::NIC.list(config[:datacenter_id], config[:server_id]).each do |nic|
35
+ ProfitBricks::NIC.list(Chef::Config[:knife][:datacenter_id], Chef::Config[:knife][:server_id]).each do |nic|
35
36
  nic_list << nic.id
36
37
  nic_list << nic.properties['name']
37
38
  nic_list << nic.properties['ips'].to_s
@@ -16,14 +16,12 @@ class Chef
16
16
  option :name,
17
17
  short: '-n NAME',
18
18
  long: '--name NAME',
19
- description: 'Name of the server',
20
- required: true
19
+ description: 'Name of the server'
21
20
 
22
21
  option :cores,
23
22
  short: '-C CORES',
24
23
  long: '--cores CORES',
25
- description: 'The number of processor cores',
26
- required: true
24
+ description: 'The number of processor cores'
27
25
 
28
26
  option :cpufamily,
29
27
  short: '-f CPU_FAMILY',
@@ -34,8 +32,7 @@ class Chef
34
32
  option :ram,
35
33
  short: '-r RAM',
36
34
  long: '--ram RAM',
37
- description: 'The amount of RAM in MB',
38
- required: true
35
+ description: 'The amount of RAM in MB'
39
36
 
40
37
  option :availabilityzone,
41
38
  short: '-a AVAILABILITY_ZONE',
@@ -53,27 +50,28 @@ class Chef
53
50
 
54
51
  def run
55
52
  $stdout.sync = true
53
+ validate_required_params(%i(datacenter_id name cores ram), Chef::Config[:knife])
56
54
 
57
55
  print "#{ui.color('Creating server...', :magenta)}"
58
56
  params = {
59
- name: config[:name],
60
- cores: config[:cores],
61
- cpuFamily: config[:cpufamily],
62
- ram: config[:ram],
63
- availabilityZone: config[:availabilityzone]
57
+ name: Chef::Config[:knife][:name],
58
+ cores: Chef::Config[:knife][:cores],
59
+ cpuFamily: Chef::Config[:knife][:cpufamily],
60
+ ram: Chef::Config[:knife][:ram],
61
+ availabilityZone: Chef::Config[:knife][:availabilityzone]
64
62
  }
65
63
 
66
- if config.key?(:bootcdrom)
67
- params[:bootCdrom] = { id: config[:bootcdrom] }
64
+ if Chef::Config[:knife][:bootcdrom]
65
+ params[:bootCdrom] = { id: Chef::Config[:knife][:bootcdrom] }
68
66
  end
69
67
 
70
- if config.key?(:bootvolume)
71
- params[:bootVolume] = { id: config[:bootvolume] }
68
+ if Chef::Config[:knife][:bootvolume]
69
+ params[:bootVolume] = { id: Chef::Config[:knife][:bootvolume] }
72
70
  end
73
71
 
74
72
  connection
75
73
  server = ProfitBricks::Server.create(
76
- config[:datacenter_id],
74
+ Chef::Config[:knife][:datacenter_id],
77
75
  params.compact
78
76
  )
79
77
 
@@ -17,7 +17,7 @@ class Chef
17
17
  connection
18
18
  @name_args.each do |server_id|
19
19
  begin
20
- server = ProfitBricks::Server.get(config[:datacenter_id], server_id)
20
+ server = ProfitBricks::Server.get(Chef::Config[:knife][:datacenter_id], server_id)
21
21
  rescue Excon::Errors::NotFound
22
22
  ui.error("Server ID #{server_id} not found. Skipping.")
23
23
  next
@@ -27,7 +27,7 @@ class Chef
27
27
  ]
28
28
  connection
29
29
 
30
- ProfitBricks::Server.list(config[:datacenter_id]).each do |server|
30
+ ProfitBricks::Server.list(Chef::Config[:knife][:datacenter_id]).each do |server|
31
31
  server_list << server.id
32
32
  server_list << server.properties['name']
33
33
  server_list << server.properties['cores'].to_s
@@ -17,7 +17,7 @@ class Chef
17
17
  connection
18
18
  @name_args.each do |server_id|
19
19
  begin
20
- server = ProfitBricks::Server.get(config[:datacenter_id], server_id)
20
+ server = ProfitBricks::Server.get(Chef::Config[:knife][:datacenter_id], server_id)
21
21
  rescue Excon::Errors::NotFound
22
22
  ui.error("Server ID #{server_id} not found. Skipping.")
23
23
  next
@@ -17,7 +17,7 @@ class Chef
17
17
  connection
18
18
  @name_args.each do |server_id|
19
19
  begin
20
- server = ProfitBricks::Server.get(config[:datacenter_id], server_id)
20
+ server = ProfitBricks::Server.get(Chef::Config[:knife][:datacenter_id], server_id)
21
21
  rescue Excon::Errors::NotFound
22
22
  ui.error("Server ID #{server_id} not found. Skipping.")
23
23
  next
@@ -17,7 +17,7 @@ class Chef
17
17
  connection
18
18
  @name_args.each do |server_id|
19
19
  begin
20
- server = ProfitBricks::Server.get(config[:datacenter_id], server_id)
20
+ server = ProfitBricks::Server.get(Chef::Config[:knife][:datacenter_id], server_id)
21
21
  rescue Excon::Errors::NotFound
22
22
  ui.error("Server ID #{server_id} not found. Skipping.")
23
23
  next
@@ -16,21 +16,21 @@ class Chef
16
16
  option :server_id,
17
17
  short: '-S SERVER_ID',
18
18
  long: '--server-id SERVER_ID',
19
- description: 'The ID of the server',
20
- required: true
19
+ description: 'The ID of the server'
21
20
 
22
21
  def run
22
+ validate_required_params(%i(datacenter_id server_id), Chef::Config[:knife])
23
+
23
24
  connection
24
25
  @name_args.each do |volume_id|
25
- volume = ProfitBricks::Volume.get(config[:datacenter_id], nil, volume_id)
26
- volume
26
+ volume = ProfitBricks::Volume.get(Chef::Config[:knife][:datacenter_id], nil, volume_id)
27
27
 
28
28
  if volume.nil?
29
29
  ui.error("Volume ID #{volume_id} not found. Skipping.")
30
30
  next
31
31
  end
32
32
 
33
- volume.attach(config[:server_id])
33
+ volume.attach(Chef::Config[:knife][:server_id])
34
34
  ui.msg("Volume #{volume_id} attached to server")
35
35
  end
36
36
  end
@@ -21,8 +21,7 @@ class Chef
21
21
  option :size,
22
22
  short: '-S SIZE',
23
23
  long: '--size SIZE',
24
- description: 'The size of the volume in GB',
25
- required: true
24
+ description: 'The size of the volume in GB'
26
25
 
27
26
  option :bus,
28
27
  short: '-b BUS',
@@ -34,6 +33,10 @@ class Chef
34
33
  long: '--image ID',
35
34
  description: 'The image or snapshot ID'
36
35
 
36
+ option :imagealias,
37
+ long: '--image-alias IMAGE_ALIAS',
38
+ description: '(required) The image alias'
39
+
37
40
  option :imagepassword,
38
41
  short: '-P PASSWORD',
39
42
  long: '--image-password PASSWORD',
@@ -42,15 +45,14 @@ class Chef
42
45
  option :type,
43
46
  short: '-t TYPE',
44
47
  long: '--type TYPE',
45
- description: 'The disk type (HDD OR SSD)',
46
- required: true
48
+ description: 'The disk type (HDD OR SSD)'
47
49
 
48
50
  option :licencetype,
49
51
  short: '-l LICENCE',
50
52
  long: '--licence-type LICENCE',
51
53
  description: 'The licence type of the volume (LINUX, WINDOWS, UNKNOWN, OTHER)'
52
54
 
53
- option :sshkeys,
55
+ option :sshkeys,
54
56
  short: '-K SSHKEY[,SSHKEY,...]',
55
57
  long: '--ssh-keys SSHKEY1,SSHKEY2,...',
56
58
  description: 'A list of public SSH keys to include',
@@ -64,33 +66,51 @@ class Chef
64
66
 
65
67
  def run
66
68
  $stdout.sync = true
69
+ validate_required_params(%i(datacenter_id name type size), Chef::Config[:knife])
70
+
71
+ if !Chef::Config[:knife][:image] && !Chef::Config[:knife][:imagealias]
72
+ ui.error("Either '--image' or '--image-alias' parameter must be provided")
73
+ exit(1)
74
+ end
75
+
76
+ if !Chef::Config[:knife][:sshkeys] && !Chef::Config[:knife][:imagepassword]
77
+ ui.error("Either '--image-password' or '--ssh-keys' parameter must be provided")
78
+ exit(1)
79
+ end
67
80
 
68
81
  print "#{ui.color('Creating volume...', :magenta)}"
69
82
 
70
83
  params = {
71
- name: config[:name],
72
- size: config[:size],
73
- bus: config[:bus] || 'VIRTIO',
74
- image: config[:image],
75
- type: config[:type],
76
- licenceType: config[:licencetype],
84
+ name: Chef::Config[:knife][:name],
85
+ size: Chef::Config[:knife][:size],
86
+ bus: Chef::Config[:knife][:bus] || 'VIRTIO',
87
+ type: Chef::Config[:knife][:type],
88
+ licenceType: Chef::Config[:knife][:licencetype],
77
89
  }
78
90
 
79
- if config[:sshkeys]
80
- params[:sshKeys] = config[:sshkeys]
91
+ if Chef::Config[:knife][:image]
92
+ params[:image] = Chef::Config[:knife][:image]
93
+ end
94
+
95
+ if Chef::Config[:knife][:imagealias]
96
+ params[:imageAlias] = Chef::Config[:knife][:imagealias]
97
+ end
98
+
99
+ if Chef::Config[:knife][:sshkeys]
100
+ params[:sshKeys] = Chef::Config[:knife][:sshkeys]
81
101
  end
82
102
 
83
- if config[:imagepassword]
84
- params[:imagePassword] = config[:imagepassword]
103
+ if Chef::Config[:knife][:imagepassword]
104
+ params[:imagePassword] = Chef::Config[:knife][:imagepassword]
85
105
  end
86
106
 
87
- if config[:volume_availability_zone]
88
- params[:availabilityZone] = config[:volume_availability_zone]
107
+ if Chef::Config[:knife][:volume_availability_zone]
108
+ params[:availabilityZone] = Chef::Config[:knife][:volume_availability_zone]
89
109
  end
90
110
 
91
111
  connection
92
112
  volume = ProfitBricks::Volume.create(
93
- config[:datacenter_id],
113
+ Chef::Config[:knife][:datacenter_id],
94
114
  params.compact
95
115
  )
96
116