knife-openstack 1.3.2 → 2.0.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.
Files changed (58) hide show
  1. checksums.yaml +4 -4
  2. data/.github/ISSUE_TEMPLATE.md +21 -0
  3. data/.gitignore +5 -0
  4. data/.travis.yml +9 -7
  5. data/CHANGELOG.md +174 -92
  6. data/Gemfile +15 -3
  7. data/README.md +96 -68
  8. data/Rakefile +19 -6
  9. data/knife-openstack.gemspec +17 -15
  10. data/lib/chef/knife/cloud/openstack_server_create_options.rb +36 -35
  11. data/lib/chef/knife/cloud/openstack_service.rb +7 -6
  12. data/lib/chef/knife/cloud/openstack_service_options.rb +18 -17
  13. data/lib/chef/knife/openstack_flavor_list.rb +11 -10
  14. data/lib/chef/knife/openstack_floating_ip_allocate.rb +13 -12
  15. data/lib/chef/knife/openstack_floating_ip_associate.rb +9 -8
  16. data/lib/chef/knife/openstack_floating_ip_disassociate.rb +9 -8
  17. data/lib/chef/knife/openstack_floating_ip_list.rb +10 -9
  18. data/lib/chef/knife/openstack_floating_ip_release.rb +7 -6
  19. data/lib/chef/knife/openstack_group_list.rb +13 -12
  20. data/lib/chef/knife/openstack_helpers.rb +8 -7
  21. data/lib/chef/knife/openstack_image_list.rb +14 -13
  22. data/lib/chef/knife/openstack_network_list.rb +10 -9
  23. data/lib/chef/knife/openstack_server_create.rb +57 -56
  24. data/lib/chef/knife/openstack_server_delete.rb +7 -6
  25. data/lib/chef/knife/openstack_server_list.rb +16 -15
  26. data/lib/chef/knife/openstack_server_show.rb +17 -16
  27. data/lib/chef/knife/openstack_volume_list.rb +10 -9
  28. data/lib/knife-openstack/version.rb +3 -2
  29. data/spec/functional/flavor_list_func_spec.rb +13 -12
  30. data/spec/functional/floating_ip_list_func_spec.rb +14 -13
  31. data/spec/functional/group_list_func_spec.rb +29 -28
  32. data/spec/functional/image_list_func_spec.rb +15 -14
  33. data/spec/functional/network_list_func_spec.rb +13 -12
  34. data/spec/functional/server_create_func_spec.rb +29 -28
  35. data/spec/functional/server_delete_func_spec.rb +18 -17
  36. data/spec/functional/server_list_func_spec.rb +43 -42
  37. data/spec/functional/server_show_func_spec.rb +7 -6
  38. data/spec/functional/volume_list_func_spec.rb +12 -11
  39. data/spec/integration/cleanup.rb +6 -5
  40. data/spec/integration/openstack_spec.rb +287 -286
  41. data/spec/spec_context.rb +10 -9
  42. data/spec/spec_helper.rb +38 -37
  43. data/spec/unit/openstack_flavor_list_spec.rb +6 -5
  44. data/spec/unit/openstack_floating_ip_allocate_spec.rb +14 -13
  45. data/spec/unit/openstack_floating_ip_associate_spec.rb +11 -10
  46. data/spec/unit/openstack_floating_ip_disassociate_spec.rb +12 -11
  47. data/spec/unit/openstack_floating_ip_list_spec.rb +6 -5
  48. data/spec/unit/openstack_floating_ip_release_spec.rb +13 -12
  49. data/spec/unit/openstack_group_list_spec.rb +11 -10
  50. data/spec/unit/openstack_image_list_spec.rb +6 -5
  51. data/spec/unit/openstack_network_list_spec.rb +8 -7
  52. data/spec/unit/openstack_server_create_spec.rb +131 -130
  53. data/spec/unit/openstack_server_delete_spec.rb +8 -7
  54. data/spec/unit/openstack_server_list_spec.rb +6 -5
  55. data/spec/unit/openstack_server_show_spec.rb +10 -9
  56. data/spec/unit/openstack_service_spec.rb +26 -25
  57. data/spec/unit/openstack_volume_list_spec.rb +6 -5
  58. metadata +9 -105
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  #
2
3
  # Author:: Mukta Aphale (<mukta.aphale@clogeny.com>)
3
4
  # Author:: Kaustubh Deorukhkar (<kaustubh@clogeny.com>)
@@ -19,17 +20,17 @@
19
20
  # See the License for the specific language governing permissions and
20
21
  # limitations under the License.
21
22
 
22
- require File.expand_path('../../spec_helper', __FILE__)
23
+ require File.expand_path("../../spec_helper", __FILE__)
23
24
 
24
25
  describe Chef::Knife::Cloud::OpenstackServerCreate do
25
26
  before do
26
27
  @knife_openstack_create = Chef::Knife::Cloud::OpenstackServerCreate.new
27
28
  {
28
- image: 'image',
29
- openstack_username: 'openstack_username',
30
- openstack_password: 'openstack_password',
31
- openstack_auth_url: 'openstack_auth_url',
32
- server_create_timeout: 1000
29
+ image: "image",
30
+ openstack_username: "openstack_username",
31
+ openstack_password: "openstack_password",
32
+ openstack_auth_url: "openstack_auth_url",
33
+ server_create_timeout: 1000,
33
34
  }.each do |key, value|
34
35
  Chef::Config[:knife][key] = value
35
36
  end
@@ -38,26 +39,26 @@ describe Chef::Knife::Cloud::OpenstackServerCreate do
38
39
  allow(@openstack_service).to receive(:msg_pair)
39
40
  allow(@openstack_service).to receive(:print)
40
41
  image = Object.new
41
- allow(image).to receive(:id).and_return('image_id')
42
+ allow(image).to receive(:id).and_return("image_id")
42
43
  allow(@openstack_service).to receive(:get_image).and_return(image)
43
44
  flavor = Object.new
44
- allow(flavor).to receive(:id).and_return('flavor_id')
45
+ allow(flavor).to receive(:id).and_return("flavor_id")
45
46
  allow(@openstack_service).to receive(:get_flavor).and_return(flavor)
46
47
 
47
48
  allow(@knife_openstack_create).to receive(:create_service_instance).and_return(@openstack_service)
48
49
  allow(@knife_openstack_create).to receive(:puts)
49
50
  @new_openstack_server = double
50
51
 
51
- @openstack_server_attribs = { name: 'Mock Server',
52
- id: 'id-123456',
53
- key_name: 'key_name',
54
- flavor: 'flavor_id',
55
- image: 'image_id',
52
+ @openstack_server_attribs = { name: "Mock Server",
53
+ id: "id-123456",
54
+ key_name: "key_name",
55
+ flavor: "flavor_id",
56
+ image: "image_id",
56
57
  addresses: {
57
- 'public' => [{ 'addr' => '75.101.253.10' }],
58
- 'private' => [{ 'addr' => '10.251.75.20' }]
58
+ "public" => [{ "addr" => "75.101.253.10" }],
59
+ "private" => [{ "addr" => "10.251.75.20" }],
59
60
  },
60
- password: 'password'
61
+ password: "password",
61
62
  }
62
63
 
63
64
  @openstack_server_attribs.each_pair do |attrib, value|
@@ -65,25 +66,25 @@ describe Chef::Knife::Cloud::OpenstackServerCreate do
65
66
  end
66
67
  end
67
68
 
68
- describe 'run' do
69
+ describe "run" do
69
70
  before(:each) do
70
71
  allow(@knife_openstack_create).to receive(:validate_params!)
71
72
  allow(Fog::Compute::OpenStack).to receive_message_chain(:new, :servers, :create).and_return(@new_openstack_server)
72
- @knife_openstack_create.config[:openstack_floating_ip] = '-1'
73
+ @knife_openstack_create.config[:openstack_floating_ip] = "-1"
73
74
  allow(@new_openstack_server).to receive(:wait_for)
74
75
  end
75
76
 
76
- context 'for Linux' do
77
+ context "for Linux" do
77
78
  before do
78
- @config = { openstack_floating_ip: '-1', bootstrap_ip_address: '75.101.253.10', ssh_password: 'password', hints: { "openstack" => {} }}
79
- @knife_openstack_create.config[:distro] = 'chef-full'
79
+ @config = { openstack_floating_ip: "-1", bootstrap_ip_address: "75.101.253.10", ssh_password: "password", hints: { "openstack" => {} } }
80
+ @knife_openstack_create.config[:distro] = "chef-full"
80
81
  @bootstrapper = Chef::Knife::Cloud::Bootstrapper.new(@config)
81
82
  @ssh_bootstrap_protocol = Chef::Knife::Cloud::SshBootstrapProtocol.new(@config)
82
83
  @unix_distribution = Chef::Knife::Cloud::UnixDistribution.new(@config)
83
84
  allow(@ssh_bootstrap_protocol).to receive(:send_bootstrap_command)
84
85
  end
85
86
 
86
- it 'Creates an OpenStack instance and bootstraps it' do
87
+ it "Creates an OpenStack instance and bootstraps it" do
87
88
  expect(Chef::Knife::Cloud::Bootstrapper).to receive(:new).with(@config).and_return(@bootstrapper)
88
89
  allow(@bootstrapper).to receive(:bootstrap).and_call_original
89
90
  expect(@bootstrapper).to receive(:create_bootstrap_protocol).and_return(@ssh_bootstrap_protocol)
@@ -93,17 +94,17 @@ describe Chef::Knife::Cloud::OpenstackServerCreate do
93
94
  end
94
95
  end
95
96
 
96
- context 'for Windows' do
97
+ context "for Windows" do
97
98
  before do
98
- @config = { openstack_floating_ip: '-1', image_os_type: 'windows', bootstrap_ip_address: '75.101.253.10', bootstrap_protocol: 'winrm', ssh_password: 'password', hints: { "openstack" => {} } }
99
- @knife_openstack_create.config[:image_os_type] = 'windows'
100
- @knife_openstack_create.config[:bootstrap_protocol] = 'winrm'
101
- @knife_openstack_create.config[:distro] = 'windows-chef-client-msi'
99
+ @config = { openstack_floating_ip: "-1", image_os_type: "windows", bootstrap_ip_address: "75.101.253.10", bootstrap_protocol: "winrm", ssh_password: "password", hints: { "openstack" => {} } }
100
+ @knife_openstack_create.config[:image_os_type] = "windows"
101
+ @knife_openstack_create.config[:bootstrap_protocol] = "winrm"
102
+ @knife_openstack_create.config[:distro] = "windows-chef-client-msi"
102
103
  @bootstrapper = Chef::Knife::Cloud::Bootstrapper.new(@config)
103
104
  @winrm_bootstrap_protocol = Chef::Knife::Cloud::WinrmBootstrapProtocol.new(@config)
104
105
  @windows_distribution = Chef::Knife::Cloud::WindowsDistribution.new(@config)
105
106
  end
106
- it 'Creates an OpenStack instance for Windows and bootstraps it' do
107
+ it "Creates an OpenStack instance for Windows and bootstraps it" do
107
108
  expect(Chef::Knife::Cloud::Bootstrapper).to receive(:new).with(@config).and_return(@bootstrapper)
108
109
  allow(@bootstrapper).to receive(:bootstrap).and_call_original
109
110
  expect(@bootstrapper).to receive(:create_bootstrap_protocol).and_return(@winrm_bootstrap_protocol)
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  #
2
3
  # Author:: Siddheshwar More (<siddheshwar.more@clogeny.com>)
3
4
  # Author:: Prabhu Das (<prabhu.das@clogeny.com>)
@@ -17,9 +18,9 @@
17
18
  # See the License for the specific language governing permissions and
18
19
  # limitations under the License.
19
20
 
20
- require File.expand_path('../../spec_helper', __FILE__)
21
- require 'chef/knife/openstack_server_delete'
22
- require 'chef/knife/cloud/openstack_service'
21
+ require File.expand_path("../../spec_helper", __FILE__)
22
+ require "chef/knife/openstack_server_delete"
23
+ require "chef/knife/cloud/openstack_service"
23
24
 
24
25
  describe Chef::Knife::Cloud::OpenstackServerDelete do
25
26
  before do
@@ -28,9 +29,9 @@ describe Chef::Knife::Cloud::OpenstackServerDelete do
28
29
  @chef_client = double(Chef::ApiClient)
29
30
  @knife_openstack_delete = Chef::Knife::Cloud::OpenstackServerDelete.new
30
31
  {
31
- openstack_username: 'openstack_username',
32
- openstack_password: 'openstack_password',
33
- openstack_auth_url: 'openstack_auth_url'
32
+ openstack_username: "openstack_username",
33
+ openstack_password: "openstack_password",
34
+ openstack_auth_url: "openstack_auth_url",
34
35
  }.each do |key, value|
35
36
  Chef::Config[:knife][key] = value
36
37
  end
@@ -42,24 +43,24 @@ describe Chef::Knife::Cloud::OpenstackServerDelete do
42
43
  allow(@knife_openstack_delete.ui).to receive(:confirm)
43
44
  @openstack_servers = double
44
45
  @running_openstack_server = double
45
- @openstack_server_attribs = { name: 'Mock Server',
46
- id: 'id-123456',
47
- flavor: 'flavor_id',
48
- image: 'image_id',
46
+ @openstack_server_attribs = { name: "Mock Server",
47
+ id: "id-123456",
48
+ flavor: "flavor_id",
49
+ image: "image_id",
49
50
  addresses: {
50
- 'public' => [{ 'addr' => '75.101.253.10' }],
51
- 'private' => [{ 'addr' => '10.251.75.20' }]
52
- }
51
+ "public" => [{ "addr" => "75.101.253.10" }],
52
+ "private" => [{ "addr" => "10.251.75.20" }],
53
+ },
53
54
  }
54
55
 
55
56
  @openstack_server_attribs.each_pair do |attrib, value|
56
57
  allow(@running_openstack_server).to receive(attrib).and_return(value)
57
58
  end
58
- @knife_openstack_delete.name_args = ['test001']
59
+ @knife_openstack_delete.name_args = ["test001"]
59
60
  end
60
61
 
61
- describe 'run' do
62
- it 'deletes an OpenStack instance.' do
62
+ describe "run" do
63
+ it "deletes an OpenStack instance." do
63
64
  expect(@openstack_servers).to receive(:get).and_return(@running_openstack_server)
64
65
  expect(@openstack_connection).to receive(:servers).and_return(@openstack_servers)
65
66
  expect(Fog::Compute::OpenStack).to receive(:new).and_return(@openstack_connection)
@@ -67,7 +68,7 @@ describe Chef::Knife::Cloud::OpenstackServerDelete do
67
68
  @knife_openstack_delete.run
68
69
  end
69
70
 
70
- it 'deletes the instance along with the node and client on the chef-server when --purge is given as an option.' do
71
+ it "deletes the instance along with the node and client on the chef-server when --purge is given as an option." do
71
72
  @knife_openstack_delete.config[:purge] = true
72
73
  expect(Chef::Node).to receive(:load).and_return(@chef_node)
73
74
  expect(@chef_node).to receive(:destroy)
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  #
2
3
  # Author:: Mukta Aphale (<mukta.aphale@clogeny.com>)
3
4
  # Author:: Siddheshwar More (<siddheshwar.more@clogeny.com>)
@@ -18,78 +19,78 @@
18
19
  # See the License for the specific language governing permissions and
19
20
  # limitations under the License.
20
21
 
21
- require 'spec_helper'
22
- require 'chef/knife/openstack_server_list'
23
- require 'chef/knife/cloud/openstack_service'
22
+ require "spec_helper"
23
+ require "chef/knife/openstack_server_list"
24
+ require "chef/knife/cloud/openstack_service"
24
25
 
25
26
  describe Chef::Knife::Cloud::OpenstackServerList do
26
27
  let (:instance) { Chef::Knife::Cloud::OpenstackServerList.new }
27
28
 
28
- context 'functionality' do
29
+ context "functionality" do
29
30
  before do
30
- @resources = [TestResource.new(id: 'resource-1', name: 'ubuntu01', availability_zone: 'test zone', addresses: { 'public' => [{ 'version' => 4, 'addr' => '172.31.6.132' }], 'private' => [{ 'version' => 4, 'addr' => '172.31.6.133' }] }, flavor: { 'id' => '1' }, image: { 'id' => 'image1' }, key_name: 'keypair', state: 'ACTIVE'),
31
- TestResource.new(id: 'resource-2', name: 'windows2008', availability_zone: 'test zone', addresses: { 'public' => [{ 'version' => 4, 'addr' => '172.31.6.132' }] }, flavor: { 'id' => 'id2' }, image: { 'id' => 'image2' }, key_name: 'keypair', state: 'ACTIVE'),
32
- TestResource.new(id: 'resource-3-err', name: 'windows2008', availability_zone: 'test zone', addresses: { 'public' => [], 'private' => [] }, flavor: { 'id' => 'id2' }, image: { 'id' => 'image2' }, key_name: 'keypair', state: 'ERROR')
31
+ @resources = [TestResource.new(id: "resource-1", name: "ubuntu01", availability_zone: "test zone", addresses: { "public" => [{ "version" => 4, "addr" => "172.31.6.132" }], "private" => [{ "version" => 4, "addr" => "172.31.6.133" }] }, flavor: { "id" => "1" }, image: { "id" => "image1" }, key_name: "keypair", state: "ACTIVE"),
32
+ TestResource.new(id: "resource-2", name: "windows2008", availability_zone: "test zone", addresses: { "public" => [{ "version" => 4, "addr" => "172.31.6.132" }] }, flavor: { "id" => "id2" }, image: { "id" => "image2" }, key_name: "keypair", state: "ACTIVE"),
33
+ TestResource.new(id: "resource-3-err", name: "windows2008", availability_zone: "test zone", addresses: { "public" => [], "private" => [] }, flavor: { "id" => "id2" }, image: { "id" => "image2" }, key_name: "keypair", state: "ERROR"),
33
34
  ]
34
35
  allow(instance).to receive(:query_resource).and_return(@resources)
35
36
  allow(instance).to receive(:puts)
36
37
  allow(instance).to receive(:create_service_instance).and_return(Chef::Knife::Cloud::FogService.new)
37
38
  allow(instance).to receive(:validate!)
38
- instance.config[:format] = 'summary'
39
+ instance.config[:format] = "summary"
39
40
  end
40
41
 
41
- it 'lists formatted list of resources' do
42
- expect(instance.ui).to receive(:list).with(['Name', 'Instance ID', 'Addresses', 'Flavor', 'Image', 'Keypair', 'State', 'Availability Zone',
43
- 'ubuntu01', 'resource-1', 'public:IPv4: 172.31.6.132', '1', 'image1', 'keypair', 'ACTIVE', 'test zone',
44
- 'windows2008', 'resource-2', 'public:IPv4: 172.31.6.132', 'id2', 'image2', 'keypair', 'ACTIVE', 'test zone',
45
- 'windows2008', 'resource-3-err', '', 'id2', 'image2', 'keypair', 'ERROR', 'test zone'], :uneven_columns_across, 8)
42
+ it "lists formatted list of resources" do
43
+ expect(instance.ui).to receive(:list).with(["Name", "Instance ID", "Addresses", "Flavor", "Image", "Keypair", "State", "Availability Zone",
44
+ "ubuntu01", "resource-1", "public:IPv4: 172.31.6.132", "1", "image1", "keypair", "ACTIVE", "test zone",
45
+ "windows2008", "resource-2", "public:IPv4: 172.31.6.132", "id2", "image2", "keypair", "ACTIVE", "test zone",
46
+ "windows2008", "resource-3-err", "", "id2", "image2", "keypair", "ERROR", "test zone"], :uneven_columns_across, 8)
46
47
  instance.run
47
48
  end
48
49
 
49
- context 'when chef-data and chef-node-attribute set' do
50
+ context "when chef-data and chef-node-attribute set" do
50
51
  before(:each) do
51
- @resources.push(TestResource.new(id: 'server-4', name: 'server-4', availability_zone: 'test zone', addresses: { 'public' => [{ 'version' => 4, 'addr' => '172.31.6.132' }], 'private' => [{ 'version' => 4, 'addr' => '172.31.6.133' }] }, flavor: { 'id' => '1' }, image: { 'id' => 'image1' }, key_name: 'keypair', state: 'ACTIVE'))
52
- @node = TestResource.new(id: 'server-4', name: 'server-4', chef_environment: '_default', fqdn: 'testfqdnnode.us', run_list: [], tags: [], platform: 'ubuntu', platform_family: 'debian')
53
- allow(Chef::Node).to receive(:list).and_return('server-4' => @node)
52
+ @resources.push(TestResource.new(id: "server-4", name: "server-4", availability_zone: "test zone", addresses: { "public" => [{ "version" => 4, "addr" => "172.31.6.132" }], "private" => [{ "version" => 4, "addr" => "172.31.6.133" }] }, flavor: { "id" => "1" }, image: { "id" => "image1" }, key_name: "keypair", state: "ACTIVE"))
53
+ @node = TestResource.new(id: "server-4", name: "server-4", chef_environment: "_default", fqdn: "testfqdnnode.us", run_list: [], tags: [], platform: "ubuntu", platform_family: "debian")
54
+ allow(Chef::Node).to receive(:list).and_return("server-4" => @node)
54
55
  instance.config[:chef_data] = true
55
56
  end
56
57
 
57
- it 'lists formatted list of resources on chef data option set' do
58
- expect(instance.ui).to receive(:list).with(['Name', 'Instance ID', 'Addresses', 'Flavor', 'Image', 'Keypair', 'State', 'Availability Zone', 'Chef Node Name', 'Environment', 'FQDN', 'Runlist', 'Tags', 'Platform',
59
- 'server-4', 'server-4', 'public:IPv4: 172.31.6.132', '1', 'image1', 'keypair', 'ACTIVE', 'test zone', 'server-4', '_default', 'testfqdnnode.us', '[]', '[]', 'ubuntu',
60
- 'ubuntu01', 'resource-1', 'public:IPv4: 172.31.6.132', '1', 'image1', 'keypair', 'ACTIVE', 'test zone', '', '', '', '', '', '',
61
- 'windows2008', 'resource-2', 'public:IPv4: 172.31.6.132', 'id2', 'image2', 'keypair', 'ACTIVE', 'test zone', '', '', '', '', '', '',
62
- 'windows2008', 'resource-3-err', '', 'id2', 'image2', 'keypair', 'ERROR', 'test zone', '', '', '', '', '', ''], :uneven_columns_across, 14)
58
+ it "lists formatted list of resources on chef data option set" do
59
+ expect(instance.ui).to receive(:list).with(["Name", "Instance ID", "Addresses", "Flavor", "Image", "Keypair", "State", "Availability Zone", "Chef Node Name", "Environment", "FQDN", "Runlist", "Tags", "Platform",
60
+ "server-4", "server-4", "public:IPv4: 172.31.6.132", "1", "image1", "keypair", "ACTIVE", "test zone", "server-4", "_default", "testfqdnnode.us", "[]", "[]", "ubuntu",
61
+ "ubuntu01", "resource-1", "public:IPv4: 172.31.6.132", "1", "image1", "keypair", "ACTIVE", "test zone", "", "", "", "", "", "",
62
+ "windows2008", "resource-2", "public:IPv4: 172.31.6.132", "id2", "image2", "keypair", "ACTIVE", "test zone", "", "", "", "", "", "",
63
+ "windows2008", "resource-3-err", "", "id2", "image2", "keypair", "ERROR", "test zone", "", "", "", "", "", ""], :uneven_columns_across, 14)
63
64
  instance.run
64
65
  end
65
66
 
66
- it 'lists formatted list of resources on chef-data and chef-node-attribute option set' do
67
- instance.config[:chef_node_attribute] = 'platform_family'
68
- expect(@node).to receive(:attribute?).with('platform_family').and_return(true)
69
- expect(instance.ui).to receive(:list).with(['Name', 'Instance ID', 'Addresses', 'Flavor', 'Image', 'Keypair', 'State', 'Availability Zone', 'Chef Node Name', 'Environment', 'FQDN', 'Runlist', 'Tags', 'Platform', 'platform_family',
70
- 'server-4', 'server-4', 'public:IPv4: 172.31.6.132', '1', 'image1', 'keypair', 'ACTIVE', 'test zone', 'server-4', '_default', 'testfqdnnode.us', '[]', '[]', 'ubuntu', 'debian',
71
- 'ubuntu01', 'resource-1', 'public:IPv4: 172.31.6.132', '1', 'image1', 'keypair', 'ACTIVE', 'test zone', '', '', '', '', '', '', '',
72
- 'windows2008', 'resource-2', 'public:IPv4: 172.31.6.132', 'id2', 'image2', 'keypair', 'ACTIVE', 'test zone', '', '', '', '', '', '', '',
73
- 'windows2008', 'resource-3-err', '', 'id2', 'image2', 'keypair', 'ERROR', 'test zone', '', '', '', '', '', '', ''], :uneven_columns_across, 15)
67
+ it "lists formatted list of resources on chef-data and chef-node-attribute option set" do
68
+ instance.config[:chef_node_attribute] = "platform_family"
69
+ expect(@node).to receive(:attribute?).with("platform_family").and_return(true)
70
+ expect(instance.ui).to receive(:list).with(["Name", "Instance ID", "Addresses", "Flavor", "Image", "Keypair", "State", "Availability Zone", "Chef Node Name", "Environment", "FQDN", "Runlist", "Tags", "Platform", "platform_family",
71
+ "server-4", "server-4", "public:IPv4: 172.31.6.132", "1", "image1", "keypair", "ACTIVE", "test zone", "server-4", "_default", "testfqdnnode.us", "[]", "[]", "ubuntu", "debian",
72
+ "ubuntu01", "resource-1", "public:IPv4: 172.31.6.132", "1", "image1", "keypair", "ACTIVE", "test zone", "", "", "", "", "", "", "",
73
+ "windows2008", "resource-2", "public:IPv4: 172.31.6.132", "id2", "image2", "keypair", "ACTIVE", "test zone", "", "", "", "", "", "", "",
74
+ "windows2008", "resource-3-err", "", "id2", "image2", "keypair", "ERROR", "test zone", "", "", "", "", "", "", ""], :uneven_columns_across, 15)
74
75
  instance.run
75
76
  end
76
77
 
77
- it 'raise error on invalid chef-node-attribute set' do
78
- instance.config[:chef_node_attribute] = 'invalid_attribute'
78
+ it "raise error on invalid chef-node-attribute set" do
79
+ instance.config[:chef_node_attribute] = "invalid_attribute"
79
80
  expect(instance.ui).to receive(:fatal)
80
- expect(@node).to receive(:attribute?).with('invalid_attribute').and_return(false)
81
- expect(instance.ui).to receive(:error).with('The Node does not have a invalid_attribute attribute.')
81
+ expect(@node).to receive(:attribute?).with("invalid_attribute").and_return(false)
82
+ expect(instance.ui).to receive(:error).with("The Node does not have a invalid_attribute attribute.")
82
83
  expect { instance.run }.to raise_error
83
84
  end
84
85
 
85
- it 'not display chef-data on chef-node-attribute set but chef-data option missing' do
86
+ it "not display chef-data on chef-node-attribute set but chef-data option missing" do
86
87
  instance.config[:chef_data] = false
87
- instance.config[:chef_node_attribute] = 'platform_family'
88
- expect(instance.ui).to receive(:list).with(['Name', 'Instance ID', 'Addresses', 'Flavor', 'Image', 'Keypair', 'State', 'Availability Zone',
89
- 'server-4', 'server-4', 'public:IPv4: 172.31.6.132', '1', 'image1', 'keypair', 'ACTIVE', 'test zone',
90
- 'ubuntu01', 'resource-1', 'public:IPv4: 172.31.6.132', '1', 'image1', 'keypair', 'ACTIVE', 'test zone',
91
- 'windows2008', 'resource-2', 'public:IPv4: 172.31.6.132', 'id2', 'image2', 'keypair', 'ACTIVE', 'test zone',
92
- 'windows2008', 'resource-3-err', '', 'id2', 'image2', 'keypair', 'ERROR', 'test zone'], :uneven_columns_across, 8)
88
+ instance.config[:chef_node_attribute] = "platform_family"
89
+ expect(instance.ui).to receive(:list).with(["Name", "Instance ID", "Addresses", "Flavor", "Image", "Keypair", "State", "Availability Zone",
90
+ "server-4", "server-4", "public:IPv4: 172.31.6.132", "1", "image1", "keypair", "ACTIVE", "test zone",
91
+ "ubuntu01", "resource-1", "public:IPv4: 172.31.6.132", "1", "image1", "keypair", "ACTIVE", "test zone",
92
+ "windows2008", "resource-2", "public:IPv4: 172.31.6.132", "id2", "image2", "keypair", "ACTIVE", "test zone",
93
+ "windows2008", "resource-3-err", "", "id2", "image2", "keypair", "ERROR", "test zone"], :uneven_columns_across, 8)
93
94
  instance.run
94
95
  end
95
96
  end
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  #
2
3
  # Author:: Ameya Varade (<ameya.varade@clogeny.com>)
3
4
  # Copyright:: Copyright (c) 2013-2014 Chef Software, Inc.
@@ -15,15 +16,15 @@
15
16
  # See the License for the specific language governing permissions and
16
17
  # limitations under the License.
17
18
 
18
- require 'spec_helper'
19
- require 'chef/knife/openstack_server_show'
20
- require 'chef/knife/cloud/openstack_service'
19
+ require "spec_helper"
20
+ require "chef/knife/openstack_server_show"
21
+ require "chef/knife/cloud/openstack_service"
21
22
 
22
23
  describe Chef::Knife::Cloud::OpenstackServerShow do
23
- context 'functionality' do
24
+ context "functionality" do
24
25
  before do
25
26
  @instance = Chef::Knife::Cloud::OpenstackServerShow.new
26
- Chef::Config[:knife][:instance_id] = 'instance_id'
27
+ Chef::Config[:knife][:instance_id] = "instance_id"
27
28
  @openstack_service = Chef::Knife::Cloud::OpenstackService.new
28
29
  allow(@openstack_service).to receive(:msg_pair)
29
30
  allow(@openstack_service).to receive(:print)
@@ -38,7 +39,7 @@ describe Chef::Knife::Cloud::OpenstackServerShow do
38
39
  expect(@openstack_service).to receive(:server_summary)
39
40
  end
40
41
 
41
- it 'runs server show successfully' do
42
+ it "runs server show successfully" do
42
43
  @instance.run
43
44
  end
44
45
  end
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  #
2
3
  # Author:: Mukta Aphale (<mukta.aphale@clogeny.com>)
3
4
  # Author:: Ameya Varade (<ameya.varade@clogeny.com>)
@@ -16,18 +17,18 @@
16
17
  # See the License for the specific language governing permissions and
17
18
  # limitations under the License.
18
19
 
19
- require 'spec_helper'
20
- require 'chef/knife/openstack_volume_list'
21
- require 'chef/knife/cloud/openstack_service'
22
- require 'support/shared_examples_for_command'
20
+ require "spec_helper"
21
+ require "chef/knife/openstack_volume_list"
22
+ require "chef/knife/cloud/openstack_service"
23
+ require "support/shared_examples_for_command"
23
24
 
24
25
  describe Chef::Knife::Cloud::OpenstackVolumeList do
25
26
  let (:instance) { Chef::Knife::Cloud::OpenstackVolumeList.new }
26
27
 
27
- context 'functionality' do
28
+ context "functionality" do
28
29
  before do
29
- resources = [TestResource.new(id: 'volume-1', name: 'big-disk-volume', status: 'available', size: 1024, description: 'This is the big disk'),
30
- TestResource.new(id: 'volume-2', name: 'little-disk-volume', status: 'in-use', size: 8, description: 'This is the little disk')
30
+ resources = [TestResource.new(id: "volume-1", name: "big-disk-volume", status: "available", size: 1024, description: "This is the big disk"),
31
+ TestResource.new(id: "volume-2", name: "little-disk-volume", status: "in-use", size: 8, description: "This is the little disk"),
31
32
  ]
32
33
  allow(instance).to receive(:query_resource).and_return(resources)
33
34
  allow(instance).to receive(:puts)
@@ -35,10 +36,10 @@ describe Chef::Knife::Cloud::OpenstackVolumeList do
35
36
  allow(instance).to receive(:validate!)
36
37
  end
37
38
 
38
- it 'lists formatted list of resources' do
39
- expect(instance.ui).to receive(:list).with(['Name', 'ID', 'Status', 'Size', 'Description',
40
- 'big-disk-volume', 'volume-1', 'available', '1024 GB', 'This is the big disk',
41
- 'little-disk-volume', 'volume-2', 'in-use', '8 GB', 'This is the little disk'], :uneven_columns_across, 5)
39
+ it "lists formatted list of resources" do
40
+ expect(instance.ui).to receive(:list).with(["Name", "ID", "Status", "Size", "Description",
41
+ "big-disk-volume", "volume-1", "available", "1024 GB", "This is the big disk",
42
+ "little-disk-volume", "volume-2", "in-use", "8 GB", "This is the little disk"], :uneven_columns_across, 5)
42
43
  instance.run
43
44
  end
44
45
  end
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  # Copyright: Copyright (c) 2013-2014 Chef Software, Inc.
2
3
  # License: Apache License, Version 2.0
3
4
  #
@@ -15,19 +16,19 @@
15
16
 
16
17
  # Author:: Siddheshwar More (<siddheshwar.more@clogeny.com>)
17
18
 
18
- require 'mixlib/shellout'
19
+ require "mixlib/shellout"
19
20
 
20
21
  module CleanupTestResources
21
22
  def self.validate_params
22
23
  unset_env_var = []
23
24
 
24
25
  # OPENSTACK_USERNAME, OPENSTACK_PASSWORD and OPENSTACK_AUTH_URL are mandatory params to run knife openstack commands.
25
- %w(OPENSTACK_USERNAME OPENSTACK_PASSWORD OPENSTACK_AUTH_URL).each do |os_env_var|
26
+ %w{OPENSTACK_USERNAME OPENSTACK_PASSWORD OPENSTACK_AUTH_URL}.each do |os_env_var|
26
27
  unset_env_var << os_env_var if ENV[os_env_var].nil?
27
28
  end
28
29
 
29
30
  err_msg = "\nPlease set #{unset_env_var.join(', ')} environment"
30
- err_msg = err_msg + (unset_env_var.length > 1 ? ' variables ' : ' variable ') + 'to cleanup test resources.'
31
+ err_msg = err_msg + (unset_env_var.length > 1 ? " variables " : " variable ") + "to cleanup test resources."
31
32
  unless unset_env_var.empty?
32
33
  puts err_msg
33
34
  exit 1
@@ -63,9 +64,9 @@ module CleanupTestResources
63
64
 
64
65
  # We use "os-integration-test-<platform>-<randomNumber>" pattern for server name during integration tests run. So use "os-integration-test-" pattern to find out servers created during integration tests run.
65
66
  servers.each_line do |line|
66
- if line.include?('os-integration-test-') || (line.include?('openstack-') && line.include?('opscode-ci-ssh'))
67
+ if line.include?("os-integration-test-") || (line.include?("openstack-") && line.include?("opscode-ci-ssh"))
67
68
  # Extract and add instance id of server to delete_resources list.
68
- delete_resources << { 'id' => line.split(' ').first, 'name' => line.split(' ')[1] }
69
+ delete_resources << { "id" => line.split(" ").first, "name" => line.split(" ")[1] }
69
70
  end
70
71
  end
71
72
 
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  # Copyright:: Copyright (c) 2013-2014 Chef Software, Inc.
2
3
  # License: Apache License, Version 2.0
3
4
  #
@@ -17,7 +18,7 @@
17
18
  # Author:: Ameya Varade (<ameya.varade@clogeny.com>)
18
19
  # Author:: Prabhu Das (<prabhu.das@clogeny.com>)
19
20
 
20
- require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
21
+ require File.expand_path(File.dirname(__FILE__) + "/../spec_helper")
21
22
 
22
23
  def append_openstack_creds(is_list_cmd = false)
23
24
  openstack_creds_cmd = " --openstack-username '#{ENV['OPENSTACK_USERNAME']}' --openstack-password '#{ENV['OPENSTACK_PASSWORD']}' --openstack-api-endpoint #{ENV['OPENSTACK_AUTH_URL']}"
@@ -54,7 +55,7 @@ end
54
55
 
55
56
  # get openstack active instance_id for knife openstack show command run
56
57
  def get_active_instance_id
57
- server_list_output = run('knife openstack server list ' + append_openstack_creds(is_list_cmd = true))
58
+ server_list_output = run("knife openstack server list " + append_openstack_creds(is_list_cmd = true))
58
59
  # Check command exitstatus. Non zero exitstatus indicates command execution fails.
59
60
  if server_list_output.exitstatus != 0
60
61
  puts "Please check Openstack user name, password and auth url are correct. Error: #{list_output.stderr}."
@@ -64,20 +65,20 @@ def get_active_instance_id
64
65
  end
65
66
 
66
67
  servers.each_line do |line|
67
- if line.include?('ACTIVE')
68
- instance_id = line.split(' ').first
68
+ if line.include?("ACTIVE")
69
+ instance_id = line.split(" ").first
69
70
  return instance_id
70
71
  end
71
72
  end
72
73
  false
73
74
  end
74
75
 
75
- describe 'knife-openstack integration test', if: is_config_present do
76
+ describe "knife-openstack integration test", if: is_config_present do
76
77
  include KnifeTestBed
77
78
  include RSpec::KnifeTestUtils
78
79
 
79
80
  before(:all) do
80
- expect(run('gem build knife-openstack.gemspec').exitstatus).to be(0)
81
+ expect(run("gem build knife-openstack.gemspec").exitstatus).to be(0)
81
82
  expect(run("gem install #{get_gem_file_name}").exitstatus).to be(0)
82
83
  init_openstack_test
83
84
  end
@@ -87,350 +88,350 @@ describe 'knife-openstack integration test', if: is_config_present do
87
88
  cleanup_test_data
88
89
  end
89
90
 
90
- describe 'display help for command' do
91
- %w(flavor\ list server\ create server\ delete server\ list group\ list image\ list network\ list ).each do |command|
91
+ describe "display help for command" do
92
+ %w{flavor\ list server\ create server\ delete server\ list group\ list image\ list network\ list }.each do |command|
92
93
  context "when --help option used with #{command} command" do
93
94
  let(:command) { "knife openstack #{command} --help" }
94
- run_cmd_check_stdout('--help')
95
+ run_cmd_check_stdout("--help")
95
96
  end
96
97
  end
97
98
  end
98
99
 
99
- describe 'display server list' do
100
- context 'when standard options specified' do
101
- let(:command) { 'knife openstack server list' + append_openstack_creds(is_list_cmd = true) }
102
- run_cmd_check_status_and_output('succeed', 'Instance ID')
100
+ describe "display server list" do
101
+ context "when standard options specified" do
102
+ let(:command) { "knife openstack server list" + append_openstack_creds(is_list_cmd = true) }
103
+ run_cmd_check_status_and_output("succeed", "Instance ID")
103
104
  end
104
105
 
105
- context 'when --chef-data CLI option specified' do
106
- let(:command) { 'knife openstack server list' + append_openstack_creds(is_list_cmd = true) + ' --chef-data' }
107
- it { skip('setup a chef-zero on workspace node') }
106
+ context "when --chef-data CLI option specified" do
107
+ let(:command) { "knife openstack server list" + append_openstack_creds(is_list_cmd = true) + " --chef-data" }
108
+ it { skip("setup a chef-zero on workspace node") }
108
109
  end
109
110
 
110
- context 'when --chef-data and valid --chef-node-attribute CLI option specified' do
111
- let(:command) { 'knife openstack server list' + append_openstack_creds(is_list_cmd = true) + ' --chef-data --chef-node-attribute platform_family' }
112
- it { skip('setup a chef-zero on workspace node') }
111
+ context "when --chef-data and valid --chef-node-attribute CLI option specified" do
112
+ let(:command) { "knife openstack server list" + append_openstack_creds(is_list_cmd = true) + " --chef-data --chef-node-attribute platform_family" }
113
+ it { skip("setup a chef-zero on workspace node") }
113
114
  end
114
115
 
115
- context 'when --chef-data and In valid --chef-node-attribute CLI option specified' do
116
- let(:command) { 'knife openstack server list' + append_openstack_creds(is_list_cmd = true) + ' --chef-data --chef-node-attribute invalid' }
117
- it { skip('setup a chef-zero on workspace node') }
116
+ context "when --chef-data and In valid --chef-node-attribute CLI option specified" do
117
+ let(:command) { "knife openstack server list" + append_openstack_creds(is_list_cmd = true) + " --chef-data --chef-node-attribute invalid" }
118
+ it { skip("setup a chef-zero on workspace node") }
118
119
  end
119
120
  end
120
121
 
121
- describe 'display flavor list' do
122
- context 'when standard options specified' do
123
- let(:command) { 'knife openstack flavor list' + append_openstack_creds(is_list_cmd = true) }
124
- run_cmd_check_status_and_output('succeed', 'ID')
122
+ describe "display flavor list" do
123
+ context "when standard options specified" do
124
+ let(:command) { "knife openstack flavor list" + append_openstack_creds(is_list_cmd = true) }
125
+ run_cmd_check_status_and_output("succeed", "ID")
125
126
  end
126
127
  end
127
128
 
128
- describe 'display image list' do
129
- context 'when standard options specified' do
130
- let(:command) { 'knife openstack image list' + append_openstack_creds(is_list_cmd = true) }
131
- run_cmd_check_status_and_output('succeed', 'ID')
129
+ describe "display image list" do
130
+ context "when standard options specified" do
131
+ let(:command) { "knife openstack image list" + append_openstack_creds(is_list_cmd = true) }
132
+ run_cmd_check_status_and_output("succeed", "ID")
132
133
  end
133
134
  end
134
135
 
135
- describe 'display group list' do
136
- context 'when standard options specified' do
137
- let(:command) { 'knife openstack group list' + append_openstack_creds(is_list_cmd = true) }
138
- run_cmd_check_status_and_output('succeed', 'Name')
136
+ describe "display group list" do
137
+ context "when standard options specified" do
138
+ let(:command) { "knife openstack group list" + append_openstack_creds(is_list_cmd = true) }
139
+ run_cmd_check_status_and_output("succeed", "Name")
139
140
  end
140
141
  end
141
142
 
142
- describe 'display network list' do
143
- context 'when standard options specified' do
144
- let(:command) { 'knife openstack network list' + append_openstack_creds(is_list_cmd = true) }
145
- it { skip 'Chef openstack setup not support this functionality' }
143
+ describe "display network list" do
144
+ context "when standard options specified" do
145
+ let(:command) { "knife openstack network list" + append_openstack_creds(is_list_cmd = true) }
146
+ it { skip "Chef openstack setup not support this functionality" }
146
147
  end
147
148
  end
148
149
 
149
- describe 'server show' do
150
- context 'with valid instance_id' do
150
+ describe "server show" do
151
+ context "with valid instance_id" do
151
152
  before(:each) do
152
153
  @instance_id = get_active_instance_id
153
154
  end
154
155
  let(:command) { "knife openstack server show #{@instance_id}" + append_openstack_creds(is_list_cmd = true) }
155
- run_cmd_check_status_and_output('succeed', 'Instance ID')
156
+ run_cmd_check_status_and_output("succeed", "Instance ID")
156
157
  end
157
158
 
158
- context 'with invalid instance_id' do
159
- let(:command) { 'knife openstack server show invalid_instance_id' + append_openstack_creds(is_list_cmd = true) }
159
+ context "with invalid instance_id" do
160
+ let(:command) { "knife openstack server show invalid_instance_id" + append_openstack_creds(is_list_cmd = true) }
160
161
 
161
- run_cmd_check_status_and_output('fail', "ERROR: Server doesn't exists for this invalid_instance_id instance id")
162
+ run_cmd_check_status_and_output("fail", "ERROR: Server doesn't exists for this invalid_instance_id instance id")
162
163
  end
163
164
  end
164
165
 
165
- describe 'create and bootstrap Linux Server' do
166
+ describe "create and bootstrap Linux Server" do
166
167
  before(:each) { rm_known_host }
167
- context 'when standard options specified' do
168
- cmd_out = ''
168
+ context "when standard options specified" do
169
+ cmd_out = ""
169
170
 
170
- before(:each) { create_node_name('linux') }
171
+ before(:each) { create_node_name("linux") }
171
172
 
172
173
  after { cmd_out = "#{cmd_output}" }
173
174
 
174
- let(:command) {
175
+ let(:command) do
175
176
  "knife openstack server create -N #{@name_node}"\
176
177
  " -I #{@os_linux_image} -f #{@os_linux_flavor} "\
177
- ' --template-file ' + get_linux_template_file_path +
178
- ' --server-url http://localhost:8889' \
179
- ' --yes --server-create-timeout 1800' +
178
+ " --template-file " + get_linux_template_file_path +
179
+ " --server-url http://localhost:8889" \
180
+ " --yes --server-create-timeout 1800" +
180
181
  get_ssh_credentials +
181
- " --identity-file #{temp_dir}/openstack.pem" + append_openstack_creds + ' --sudo'
182
- }
182
+ " --identity-file #{temp_dir}/openstack.pem" + append_openstack_creds + " --sudo"
183
+ end
183
184
 
184
- run_cmd_check_status_and_output('succeed', "#{@name_node}")
185
+ run_cmd_check_status_and_output("succeed", "#{@name_node}")
185
186
 
186
- context 'delete server after create' do
187
+ context "delete server after create" do
187
188
  let(:command) { delete_instance_cmd(cmd_out) }
188
- run_cmd_check_status_and_output('succeed', "#{@name_node}")
189
+ run_cmd_check_status_and_output("succeed", "#{@name_node}")
189
190
  end
190
191
  end
191
192
 
192
- context 'when standard options and chef node name prefix is default value(i.e openstack)' do
193
- let(:command) {
194
- 'knife openstack server create '\
193
+ context "when standard options and chef node name prefix is default value(i.e openstack)" do
194
+ let(:command) do
195
+ "knife openstack server create "\
195
196
  " -I #{@os_linux_image} -f #{@os_linux_flavor} "\
196
- ' --template-file ' + get_linux_template_file_path +
197
- ' --server-url http://localhost:8889' \
198
- ' --yes --server-create-timeout 1800' +
197
+ " --template-file " + get_linux_template_file_path +
198
+ " --server-url http://localhost:8889" \
199
+ " --yes --server-create-timeout 1800" +
199
200
  get_ssh_credentials +
200
- " --identity-file #{temp_dir}/openstack.pem" + append_openstack_creds + ' --sudo'
201
- }
201
+ " --identity-file #{temp_dir}/openstack.pem" + append_openstack_creds + " --sudo"
202
+ end
202
203
 
203
204
  after { run(delete_instance_cmd("#{cmd_output}")) }
204
205
 
205
- run_cmd_check_status_and_output('succeed', 'Bootstrapping Chef on')
206
+ run_cmd_check_status_and_output("succeed", "Bootstrapping Chef on")
206
207
  end
207
208
 
208
- context 'when standard options and chef node name prefix is user specified value' do
209
- let(:command) {
210
- 'knife openstack server create '\
209
+ context "when standard options and chef node name prefix is user specified value" do
210
+ let(:command) do
211
+ "knife openstack server create "\
211
212
  " -I #{@os_linux_image} -f #{@os_linux_flavor} "\
212
- ' --template-file ' + get_linux_template_file_path +
213
- ' --server-url http://localhost:8889' \
214
- ' --yes --server-create-timeout 1800' \
215
- ' --chef-node-name-prefix os-integration-test-' +
213
+ " --template-file " + get_linux_template_file_path +
214
+ " --server-url http://localhost:8889" \
215
+ " --yes --server-create-timeout 1800" \
216
+ " --chef-node-name-prefix os-integration-test-" +
216
217
  get_ssh_credentials +
217
- " --identity-file #{temp_dir}/openstack.pem" + append_openstack_creds + ' --sudo'
218
- }
218
+ " --identity-file #{temp_dir}/openstack.pem" + append_openstack_creds + " --sudo"
219
+ end
219
220
 
220
221
  after { run(delete_instance_cmd("#{cmd_output}")) }
221
222
 
222
- run_cmd_check_status_and_output('succeed', 'os-integration-test-')
223
+ run_cmd_check_status_and_output("succeed", "os-integration-test-")
223
224
  end
224
225
 
225
- context 'when standard options and delete-server-on-failure specified' do
226
- nodename = ''
227
- before(:each) { create_node_name('linux') }
226
+ context "when standard options and delete-server-on-failure specified" do
227
+ nodename = ""
228
+ before(:each) { create_node_name("linux") }
228
229
 
229
230
  after { nodename = @name_node }
230
231
 
231
- let(:command) {
232
+ let(:command) do
232
233
  "knife openstack server create -N #{@name_node}"\
233
234
  " -I #{@os_linux_image} -f #{@os_linux_flavor} "\
234
- ' --template-file ' + get_linux_template_file_path +
235
- ' --server-url http://localhost:8889' \
236
- ' --yes --server-create-timeout 1800' \
237
- ' --delete-server-on-failure' +
235
+ " --template-file " + get_linux_template_file_path +
236
+ " --server-url http://localhost:8889" \
237
+ " --yes --server-create-timeout 1800" \
238
+ " --delete-server-on-failure" +
238
239
  get_ssh_credentials +
239
- " --identity-file #{temp_dir}/openstack.pem" + append_openstack_creds + ' --sudo'
240
- }
240
+ " --identity-file #{temp_dir}/openstack.pem" + append_openstack_creds + " --sudo"
241
+ end
241
242
 
242
- run_cmd_check_status_and_output('succeed', "#{@name_node}")
243
+ run_cmd_check_status_and_output("succeed", "#{@name_node}")
243
244
 
244
- context 'delete server by using name after create' do
245
- let(:command) { "knife openstack server delete #{nodename} " + append_openstack_creds(is_list_cmd = true) + ' --yes' }
246
- run_cmd_check_status_and_output('succeed', "#{@name_node}")
245
+ context "delete server by using name after create" do
246
+ let(:command) { "knife openstack server delete #{nodename} " + append_openstack_creds(is_list_cmd = true) + " --yes" }
247
+ run_cmd_check_status_and_output("succeed", "#{@name_node}")
247
248
  end
248
249
  end
249
250
 
250
- context 'when delete-server-on-failure specified and bootstrap fails' do
251
- before(:each) { create_node_name('linux') }
251
+ context "when delete-server-on-failure specified and bootstrap fails" do
252
+ before(:each) { create_node_name("linux") }
252
253
 
253
- let(:command) {
254
+ let(:command) do
254
255
  "knife openstack server create -N #{@name_node}"\
255
256
  " -I #{@os_linux_image} -f #{@os_linux_flavor} "\
256
- ' --template-file ' + get_linux_template_file_path +
257
- ' --server-url http://localhost:8889' \
258
- ' --yes --server-create-timeout 1800' \
259
- ' --delete-server-on-failure' +
257
+ " --template-file " + get_linux_template_file_path +
258
+ " --server-url http://localhost:8889" \
259
+ " --yes --server-create-timeout 1800" \
260
+ " --delete-server-on-failure" +
260
261
  get_ssh_credentials +
261
- " --identity-file #{temp_dir}/incorrect_openstack.pem" + append_openstack_creds + ' --sudo'
262
- }
262
+ " --identity-file #{temp_dir}/incorrect_openstack.pem" + append_openstack_creds + " --sudo"
263
+ end
263
264
 
264
- run_cmd_check_status_and_output('fail', 'FATAL: Authentication Failed during bootstrapping')
265
+ run_cmd_check_status_and_output("fail", "FATAL: Authentication Failed during bootstrapping")
265
266
  end
266
267
 
267
- context 'when openstack credentials not specified' do
268
- before(:each) { create_node_name('linux') }
268
+ context "when openstack credentials not specified" do
269
+ before(:each) { create_node_name("linux") }
269
270
 
270
- let(:command) {
271
+ let(:command) do
271
272
  "knife openstack server create -N #{@name_node}"\
272
273
  " -I #{@os_linux_image} -f #{@os_linux_flavor} "\
273
- ' --template-file ' + get_linux_template_file_path +
274
- ' --server-url http://localhost:8889' \
275
- ' --yes --server-create-timeout 1800' +
274
+ " --template-file " + get_linux_template_file_path +
275
+ " --server-url http://localhost:8889" \
276
+ " --yes --server-create-timeout 1800" +
276
277
  get_ssh_credentials +
277
278
  " --identity-file #{temp_dir}/openstack.pem --sudo"
278
- }
279
+ end
279
280
 
280
- run_cmd_check_status_and_output('fail', "ERROR: You did not provide a valid 'Openstack Username' value")
281
+ run_cmd_check_status_and_output("fail", "ERROR: You did not provide a valid 'Openstack Username' value")
281
282
  end
282
283
 
283
- context 'when ssh-password and identity-file parameters not specified' do
284
- before(:each) { create_node_name('linux') }
284
+ context "when ssh-password and identity-file parameters not specified" do
285
+ before(:each) { create_node_name("linux") }
285
286
 
286
- let(:command) {
287
+ let(:command) do
287
288
  "knife openstack server create -N #{@name_node}"\
288
289
  " -I #{@os_linux_image} -f #{@os_linux_flavor} "\
289
- ' --template-file ' + get_linux_template_file_path +
290
- ' --server-url http://localhost:8889' \
291
- ' --yes' +
292
- append_openstack_creds + ' --sudo'
293
- }
290
+ " --template-file " + get_linux_template_file_path +
291
+ " --server-url http://localhost:8889" \
292
+ " --yes" +
293
+ append_openstack_creds + " --sudo"
294
+ end
294
295
 
295
- it { skip 'Chef openstack setup not support this functionality.' }
296
+ it { skip "Chef openstack setup not support this functionality." }
296
297
  end
297
298
 
298
- context 'when standard options and invalid openstack security group specified' do
299
- before(:each) { create_node_name('linux') }
299
+ context "when standard options and invalid openstack security group specified" do
300
+ before(:each) { create_node_name("linux") }
300
301
 
301
- let(:command) {
302
+ let(:command) do
302
303
  "knife openstack server create -N #{@name_node}"\
303
304
  " -I #{@os_linux_image} -f #{@os_linux_flavor} "\
304
- ' --template-file ' + get_linux_template_file_path +
305
- ' --server-url http://localhost:8889' \
306
- ' --yes' +
305
+ " --template-file " + get_linux_template_file_path +
306
+ " --server-url http://localhost:8889" \
307
+ " --yes" +
307
308
  get_ssh_credentials +
308
309
  " --identity-file #{temp_dir}/openstack.pem"\
309
- ' --openstack-groups invalid-invalid-1212' + append_openstack_creds + ' --sudo'
310
- }
310
+ " --openstack-groups invalid-invalid-1212" + append_openstack_creds + " --sudo"
311
+ end
311
312
 
312
- run_cmd_check_status_and_output('fail', 'Security group invalid-invalid-1212 not found')
313
+ run_cmd_check_status_and_output("fail", "Security group invalid-invalid-1212 not found")
313
314
  end
314
315
 
315
- context 'when standard options and invalid image id specified' do
316
- before(:each) { create_node_name('linux') }
316
+ context "when standard options and invalid image id specified" do
317
+ before(:each) { create_node_name("linux") }
317
318
 
318
- let(:command) {
319
+ let(:command) do
319
320
  "knife openstack server create -N #{@name_node}"\
320
321
  " -I #{SecureRandom.hex(18)} -f #{@os_linux_flavor} "\
321
- ' --template-file ' + get_linux_template_file_path +
322
- ' --server-url http://localhost:8889' \
323
- ' --yes' +
322
+ " --template-file " + get_linux_template_file_path +
323
+ " --server-url http://localhost:8889" \
324
+ " --yes" +
324
325
  get_ssh_credentials +
325
- " --identity-file #{temp_dir}/openstack.pem" + append_openstack_creds + ' --sudo'
326
- }
326
+ " --identity-file #{temp_dir}/openstack.pem" + append_openstack_creds + " --sudo"
327
+ end
327
328
 
328
- run_cmd_check_status_and_output('fail', 'ERROR: You have not provided a valid image ID. Please note the options for this value are -I or --image')
329
+ run_cmd_check_status_and_output("fail", "ERROR: You have not provided a valid image ID. Please note the options for this value are -I or --image")
329
330
  end
330
331
 
331
- context 'when standard options and invalid flavor id specified' do
332
- before(:each) { create_node_name('linux') }
332
+ context "when standard options and invalid flavor id specified" do
333
+ before(:each) { create_node_name("linux") }
333
334
 
334
- let(:command) {
335
+ let(:command) do
335
336
  "knife openstack server create -N #{@name_node}"\
336
337
  " -I #{@os_linux_image} -f #{@os_invalid_flavor} "\
337
- ' --template-file ' + get_linux_template_file_path +
338
- ' --server-url http://localhost:8889' \
339
- ' --yes' +
338
+ " --template-file " + get_linux_template_file_path +
339
+ " --server-url http://localhost:8889" \
340
+ " --yes" +
340
341
  get_ssh_credentials +
341
- " --identity-file #{temp_dir}/openstack.pem" + append_openstack_creds + ' --sudo'
342
- }
342
+ " --identity-file #{temp_dir}/openstack.pem" + append_openstack_creds + " --sudo"
343
+ end
343
344
 
344
- run_cmd_check_status_and_output('fail', 'ERROR: You have not provided a valid flavor ID. Please note the options for this value are -f or --flavor')
345
+ run_cmd_check_status_and_output("fail", "ERROR: You have not provided a valid flavor ID. Please note the options for this value are -f or --flavor")
345
346
  end
346
347
 
347
- context 'when standard options and invalid floating ip specified' do
348
- before(:each) { create_node_name('linux') }
348
+ context "when standard options and invalid floating ip specified" do
349
+ before(:each) { create_node_name("linux") }
349
350
 
350
- let(:command) {
351
+ let(:command) do
351
352
  "knife openstack server create -N #{@name_node}"\
352
353
  " -I #{@os_linux_image} --openstack-floating-ip #{@os_invalid_floating_ip} "\
353
- ' --template-file ' + get_linux_template_file_path +
354
- ' --server-url http://localhost:8889' \
355
- ' --yes' +
354
+ " --template-file " + get_linux_template_file_path +
355
+ " --server-url http://localhost:8889" \
356
+ " --yes" +
356
357
  get_ssh_credentials +
357
- " --identity-file #{temp_dir}/openstack.pem" + append_openstack_creds + ' --sudo'
358
- }
358
+ " --identity-file #{temp_dir}/openstack.pem" + append_openstack_creds + " --sudo"
359
+ end
359
360
 
360
- run_cmd_check_status_and_output('fail', 'ERROR: You have either requested an invalid floating IP address or none are available')
361
+ run_cmd_check_status_and_output("fail", "ERROR: You have either requested an invalid floating IP address or none are available")
361
362
  end
362
363
 
363
- context 'when invalid key_pair specified' do
364
- before(:each) { create_node_name('linux') }
364
+ context "when invalid key_pair specified" do
365
+ before(:each) { create_node_name("linux") }
365
366
 
366
- let(:command) {
367
+ let(:command) do
367
368
  "knife openstack server create -N #{@name_node}"\
368
369
  " -I #{@os_linux_image} -f #{@os_linux_flavor} "\
369
- ' --template-file ' + get_linux_template_file_path +
370
- ' --server-url http://localhost:8889' \
371
- ' --yes' \
370
+ " --template-file " + get_linux_template_file_path +
371
+ " --server-url http://localhost:8889" \
372
+ " --yes" \
372
373
  " --ssh-user #{@os_ssh_user}"\
373
374
  " --openstack-ssh-key-id #{SecureRandom.hex(6)}"\
374
- " --identity-file #{temp_dir}/openstack.pem" + append_openstack_creds + ' --sudo'
375
- }
375
+ " --identity-file #{temp_dir}/openstack.pem" + append_openstack_creds + " --sudo"
376
+ end
376
377
 
377
- run_cmd_check_status_and_output('fail', 'Invalid key_name provided')
378
+ run_cmd_check_status_and_output("fail", "Invalid key_name provided")
378
379
  end
379
380
 
380
- context 'when incorrect openstack private_key.pem file is used' do
381
+ context "when incorrect openstack private_key.pem file is used" do
381
382
  server_create_common_bfr_aftr
382
383
 
383
- let(:command) {
384
+ let(:command) do
384
385
  "knife openstack server create -N #{@name_node}"\
385
386
  " -I #{@os_linux_image} -f #{@os_linux_flavor} "\
386
- ' --template-file ' + get_linux_template_file_path +
387
- ' --server-url http://localhost:8889' \
388
- ' --yes' \
387
+ " --template-file " + get_linux_template_file_path +
388
+ " --server-url http://localhost:8889" \
389
+ " --yes" \
389
390
  " --ssh-user #{@os_ssh_user}"\
390
391
  " --openstack-ssh-key-id #{@openstack_key_pair}"\
391
- " --identity-file #{temp_dir}/incorrect_openstack.pem" + append_openstack_creds + ' --sudo'
392
- }
392
+ " --identity-file #{temp_dir}/incorrect_openstack.pem" + append_openstack_creds + " --sudo"
393
+ end
393
394
 
394
- run_cmd_check_status_and_output('fail', 'FATAL: Authentication Failed during bootstrapping')
395
+ run_cmd_check_status_and_output("fail", "FATAL: Authentication Failed during bootstrapping")
395
396
  end
396
397
 
397
- context 'when standard options and --openstack-private-network option specified' do
398
+ context "when standard options and --openstack-private-network option specified" do
398
399
  server_create_common_bfr_aftr
399
400
 
400
- let(:command) {
401
+ let(:command) do
401
402
  "knife openstack server create -N #{@name_node}"\
402
403
  " -I #{@os_linux_image} -f #{@os_linux_flavor} "\
403
- ' --template-file ' + get_linux_template_file_path +
404
- ' --server-url http://localhost:8889' \
405
- ' --yes' +
404
+ " --template-file " + get_linux_template_file_path +
405
+ " --server-url http://localhost:8889" \
406
+ " --yes" +
406
407
  get_ssh_credentials +
407
408
  " --identity-file #{temp_dir}/openstack.pem"\
408
- ' --openstack-private-network' + append_openstack_creds + ' --sudo'
409
- }
409
+ " --openstack-private-network" + append_openstack_creds + " --sudo"
410
+ end
410
411
 
411
- it { skip 'not yet supported' }
412
+ it { skip "not yet supported" }
412
413
  end
413
414
 
414
- context 'when standard options and --openstack-floating-ip option specified' do
415
+ context "when standard options and --openstack-floating-ip option specified" do
415
416
  server_create_common_bfr_aftr
416
417
 
417
- let(:command) {
418
+ let(:command) do
418
419
  "knife openstack server create -N #{@name_node}"\
419
420
  " -I #{@os_linux_image} -f #{@os_linux_flavor} "\
420
- ' --template-file ' + get_linux_template_file_path +
421
- ' --server-url http://localhost:8889' \
422
- ' --yes' +
421
+ " --template-file " + get_linux_template_file_path +
422
+ " --server-url http://localhost:8889" \
423
+ " --yes" +
423
424
  get_ssh_credentials +
424
425
  " --identity-file #{temp_dir}/openstack.pem"\
425
- ' --openstack-floating-ip' + append_openstack_creds + ' --sudo'
426
- }
426
+ " --openstack-floating-ip" + append_openstack_creds + " --sudo"
427
+ end
427
428
 
428
- it { skip 'empty floating ip pool' }
429
+ it { skip "empty floating ip pool" }
429
430
  end
430
431
 
431
- context 'when standard options and user data specified' do
432
+ context "when standard options and user data specified" do
432
433
  before(:each) do
433
- create_node_name('linux')
434
+ create_node_name("linux")
434
435
  @user_data_file = create_sh_user_data_file
435
436
  end
436
437
 
@@ -441,208 +442,208 @@ describe 'knife-openstack integration test', if: is_config_present do
441
442
  run(delete_instance_cmd("#{cmd_output}"))
442
443
  end
443
444
 
444
- let(:command) {
445
+ let(:command) do
445
446
  "knife openstack server create -N #{@name_node}"\
446
447
  " -I #{@os_linux_image} -f #{@os_linux_flavor} "\
447
- ' --template-file ' + get_linux_template_file_path +
448
- ' --server-url http://localhost:8889' \
449
- ' --yes --server-create-timeout 1800' +
448
+ " --template-file " + get_linux_template_file_path +
449
+ " --server-url http://localhost:8889" \
450
+ " --yes --server-create-timeout 1800" +
450
451
  get_ssh_credentials +
451
452
  " --identity-file #{temp_dir}/openstack.pem" \
452
453
  " --user-data #{@user_data_file.path}" +
453
- append_openstack_creds + ' --sudo -VV'
454
- }
454
+ append_openstack_creds + " --sudo -VV"
455
+ end
455
456
 
456
- run_cmd_check_status_and_output('succeed', "#{@name_node}")
457
+ run_cmd_check_status_and_output("succeed", "#{@name_node}")
457
458
  end
458
459
 
459
- context 'when standard options and no network option specified' do
460
+ context "when standard options and no network option specified" do
460
461
  server_create_common_bfr_aftr
461
462
 
462
- let(:command) {
463
+ let(:command) do
463
464
  "knife openstack server create -N #{@name_node}"\
464
465
  " -I #{@os_linux_image} -f #{@os_linux_flavor} "\
465
- ' --template-file ' + get_linux_template_file_path +
466
- ' --server-url http://localhost:8889' \
467
- ' --yes --server-create-timeout 1800' \
468
- ' --no-network' +
466
+ " --template-file " + get_linux_template_file_path +
467
+ " --server-url http://localhost:8889" \
468
+ " --yes --server-create-timeout 1800" \
469
+ " --no-network" +
469
470
  get_ssh_credentials +
470
- " --identity-file #{temp_dir}/openstack.pem" + append_openstack_creds + ' --sudo'
471
- }
471
+ " --identity-file #{temp_dir}/openstack.pem" + append_openstack_creds + " --sudo"
472
+ end
472
473
 
473
- run_cmd_check_status_and_output('succeed', "#{@name_node}")
474
+ run_cmd_check_status_and_output("succeed", "#{@name_node}")
474
475
  end
475
476
 
476
- context 'when standard options and openstack endpoint type option is specified' do
477
+ context "when standard options and openstack endpoint type option is specified" do
477
478
  server_create_common_bfr_aftr
478
479
 
479
- let(:command) {
480
+ let(:command) do
480
481
  "knife openstack server create -N #{@name_node}"\
481
482
  " -I #{@os_linux_image} -f #{@os_linux_flavor} "\
482
- ' --template-file ' + get_linux_template_file_path +
483
- ' --server-url http://localhost:8889' \
484
- ' --yes --server-create-timeout 1800' \
485
- ' --openstack-endpoint-type publicURL' +
483
+ " --template-file " + get_linux_template_file_path +
484
+ " --server-url http://localhost:8889" \
485
+ " --yes --server-create-timeout 1800" \
486
+ " --openstack-endpoint-type publicURL" +
486
487
  get_ssh_credentials +
487
- " --identity-file #{temp_dir}/openstack.pem" + append_openstack_creds + ' --sudo'
488
- }
488
+ " --identity-file #{temp_dir}/openstack.pem" + append_openstack_creds + " --sudo"
489
+ end
489
490
 
490
- run_cmd_check_status_and_output('succeed', "#{@name_node}")
491
+ run_cmd_check_status_and_output("succeed", "#{@name_node}")
491
492
  end
492
493
 
493
- context 'when standard options and openstack metadata option is specified' do
494
+ context "when standard options and openstack metadata option is specified" do
494
495
  server_create_common_bfr_aftr
495
496
 
496
- let(:command) {
497
+ let(:command) do
497
498
  "knife openstack server create -N #{@name_node}"\
498
499
  " -I #{@os_linux_image} -f #{@os_linux_flavor} "\
499
- ' --template-file ' + get_linux_template_file_path +
500
- ' --server-url http://localhost:8889' \
501
- ' --yes --server-create-timeout 1800' \
500
+ " --template-file " + get_linux_template_file_path +
501
+ " --server-url http://localhost:8889" \
502
+ " --yes --server-create-timeout 1800" \
502
503
  " --metadata testdataone='testmetadata'" +
503
504
  get_ssh_credentials +
504
505
  " --identity-file #{temp_dir}/openstack.pem"\
505
506
  " --metadata testdatatwo='testmetadata'" +
506
- append_openstack_creds + ' --sudo'
507
- }
507
+ append_openstack_creds + " --sudo"
508
+ end
508
509
 
509
- run_cmd_check_status_and_output('succeed', "#{@name_node}")
510
+ run_cmd_check_status_and_output("succeed", "#{@name_node}")
510
511
  end
511
512
 
512
- context 'when standard options and openstack network-ids option is specified' do
513
+ context "when standard options and openstack network-ids option is specified" do
513
514
  server_create_common_bfr_aftr
514
515
 
515
- let(:command) {
516
+ let(:command) do
516
517
  "knife openstack server create -N #{@name_node}"\
517
518
  " -I #{@os_linux_image} -f #{@os_linux_flavor} "\
518
- ' --template-file ' + get_linux_template_file_path +
519
- ' --server-url http://localhost:8889' \
520
- ' --yes --server-create-timeout 1800' \
519
+ " --template-file " + get_linux_template_file_path +
520
+ " --server-url http://localhost:8889" \
521
+ " --yes --server-create-timeout 1800" \
521
522
  " --network-ids #{@os_network_ids} " +
522
523
  get_ssh_credentials +
523
- " --identity-file #{temp_dir}/openstack.pem" + append_openstack_creds + ' --sudo'
524
- }
524
+ " --identity-file #{temp_dir}/openstack.pem" + append_openstack_creds + " --sudo"
525
+ end
525
526
 
526
- it { skip 'Chef openstack setup not support this functionality' }
527
+ it { skip "Chef openstack setup not support this functionality" }
527
528
  end
528
529
 
529
- context 'when standard options and openstack availability-zone option is specified' do
530
+ context "when standard options and openstack availability-zone option is specified" do
530
531
  server_create_common_bfr_aftr
531
532
 
532
- let(:command) {
533
+ let(:command) do
533
534
  "knife openstack server create -N #{@name_node}"\
534
535
  " -I #{@os_linux_image} -f #{@os_linux_flavor} "\
535
- ' --template-file ' + get_linux_template_file_path +
536
- ' --server-url http://localhost:8889' \
537
- ' --yes --server-create-timeout 1800' \
536
+ " --template-file " + get_linux_template_file_path +
537
+ " --server-url http://localhost:8889" \
538
+ " --yes --server-create-timeout 1800" \
538
539
  " --availability-zone #{@os_availability_zone} " +
539
540
  get_ssh_credentials +
540
- " --identity-file #{temp_dir}/openstack.pem" + append_openstack_creds + ' --sudo'
541
- }
541
+ " --identity-file #{temp_dir}/openstack.pem" + append_openstack_creds + " --sudo"
542
+ end
542
543
 
543
- it { skip 'Chef openstack setup not support this functionality' }
544
+ it { skip "Chef openstack setup not support this functionality" }
544
545
  end
545
546
  end
546
547
 
547
- describe 'create and bootstrap Windows Server' do
548
+ describe "create and bootstrap Windows Server" do
548
549
  before(:each) { rm_known_host }
549
550
 
550
- context 'when standard options specified' do
551
- cmd_out = ''
551
+ context "when standard options specified" do
552
+ cmd_out = ""
552
553
 
553
- before(:each) { create_node_name('windows') }
554
+ before(:each) { create_node_name("windows") }
554
555
 
555
- let(:command) {
556
+ let(:command) do
556
557
  "knife openstack server create -N #{@name_node}" \
557
558
  " -I #{@os_windows_image} " \
558
559
  " -f #{@os_windows_flavor} " \
559
- ' --template-file ' + get_windows_msi_template_file_path +
560
- ' --server-url http://localhost:8889' \
561
- ' --bootstrap-protocol winrm' \
562
- ' --yes --server-create-timeout 1800' +
560
+ " --template-file " + get_windows_msi_template_file_path +
561
+ " --server-url http://localhost:8889" \
562
+ " --bootstrap-protocol winrm" \
563
+ " --yes --server-create-timeout 1800" +
563
564
  get_winrm_credentials + append_openstack_creds_for_windows
564
- }
565
+ end
565
566
 
566
567
  after { cmd_out = "#{cmd_output}" }
567
568
 
568
- run_cmd_check_status_and_output('succeed', "#{@name_node}")
569
+ run_cmd_check_status_and_output("succeed", "#{@name_node}")
569
570
 
570
- context 'delete server after create' do
571
+ context "delete server after create" do
571
572
  let(:command) { delete_instance_cmd(cmd_out) }
572
- run_cmd_check_status_and_output('succeed')
573
+ run_cmd_check_status_and_output("succeed")
573
574
  end
574
575
  end
575
576
 
576
- context 'when invalid winrm user specified' do
577
- server_create_common_bfr_aftr('windows')
577
+ context "when invalid winrm user specified" do
578
+ server_create_common_bfr_aftr("windows")
578
579
 
579
- let(:command) {
580
+ let(:command) do
580
581
  "knife openstack server create -N #{@name_node}" \
581
582
  " -I #{@os_windows_image} " \
582
583
  " -f #{@os_windows_flavor} " \
583
- ' --template-file ' + get_windows_msi_template_file_path +
584
- ' --server-url http://localhost:8889' \
585
- ' --bootstrap-protocol winrm' \
586
- ' --yes --server-create-timeout 1800' \
584
+ " --template-file " + get_windows_msi_template_file_path +
585
+ " --server-url http://localhost:8889" \
586
+ " --bootstrap-protocol winrm" \
587
+ " --yes --server-create-timeout 1800" \
587
588
  " --winrm-user #{SecureRandom.hex(6)}"\
588
589
  " --winrm-password #{@os_winrm_password}" +
589
590
  append_openstack_creds_for_windows
590
- }
591
- it { skip 'Fails due to OC-9708 bug in knife-windows.' }
591
+ end
592
+ it { skip "Fails due to OC-9708 bug in knife-windows." }
592
593
  end
593
594
 
594
- context 'when invalid winrm password specified' do
595
- server_create_common_bfr_aftr('windows')
595
+ context "when invalid winrm password specified" do
596
+ server_create_common_bfr_aftr("windows")
596
597
 
597
- let(:command) {
598
+ let(:command) do
598
599
  "knife openstack server create -N #{@name_node}" \
599
600
  " -I #{@os_windows_image} " \
600
601
  " -f #{@os_windows_flavor} " \
601
- ' --template-file ' + get_windows_msi_template_file_path +
602
- ' --server-url http://localhost:8889' \
603
- ' --bootstrap-protocol winrm' \
604
- ' --yes --server-create-timeout 1800' \
602
+ " --template-file " + get_windows_msi_template_file_path +
603
+ " --server-url http://localhost:8889" \
604
+ " --bootstrap-protocol winrm" \
605
+ " --yes --server-create-timeout 1800" \
605
606
  " --winrm-user #{@os_winrm_user}"\
606
607
  " --winrm-password #{SecureRandom.hex(6)}" +
607
608
  append_openstack_creds_for_windows
608
- }
609
+ end
609
610
  after(:each) { run(delete_instance_cmd("#{cmd_output}")) }
610
611
 
611
- it { skip 'Fails due to OC-9708 bug in knife-windows.' }
612
+ it { skip "Fails due to OC-9708 bug in knife-windows." }
612
613
  end
613
614
 
614
- context 'when standard options ssh bootstrap and valid image-os-type protocol specified' do
615
- server_create_common_bfr_aftr('windows')
615
+ context "when standard options ssh bootstrap and valid image-os-type protocol specified" do
616
+ server_create_common_bfr_aftr("windows")
616
617
 
617
- let(:command) {
618
+ let(:command) do
618
619
  "knife openstack server create -N #{@name_node}"\
619
620
  " -I #{@os_windows_ssh_image}"\
620
621
  " -f #{@os_windows_flavor} "\
621
- ' --template-file ' + get_windows_msi_template_file_path +
622
- ' --server-url http://localhost:8889' \
623
- ' --yes --server-create-timeout 1800' \
622
+ " --template-file " + get_windows_msi_template_file_path +
623
+ " --server-url http://localhost:8889" \
624
+ " --yes --server-create-timeout 1800" \
624
625
  " --identity-file #{temp_dir}/openstack.pem"\
625
- " --openstack-ssh-key-id #{@openstack_key_pair}" + get_ssh_credentials_for_windows_image + append_openstack_creds + ' --image-os-type windows'
626
- }
626
+ " --openstack-ssh-key-id #{@openstack_key_pair}" + get_ssh_credentials_for_windows_image + append_openstack_creds + " --image-os-type windows"
627
+ end
627
628
 
628
- run_cmd_check_status_and_output('succeed', "#{@name_node}")
629
+ run_cmd_check_status_and_output("succeed", "#{@name_node}")
629
630
  end
630
631
 
631
- context 'when standard options ssh bootstrap and invalid image-os-type protocol specified' do
632
- before(:each) { create_node_name('windows') }
632
+ context "when standard options ssh bootstrap and invalid image-os-type protocol specified" do
633
+ before(:each) { create_node_name("windows") }
633
634
 
634
- let(:command) {
635
+ let(:command) do
635
636
  "knife openstack server create -N #{@name_node}"\
636
637
  " -I #{@os_windows_ssh_image}"\
637
638
  " -f #{@os_windows_flavor} "\
638
- ' --template-file ' + get_windows_msi_template_file_path +
639
- ' --server-url http://localhost:8889' \
640
- ' --yes --server-create-timeout 1800' \
639
+ " --template-file " + get_windows_msi_template_file_path +
640
+ " --server-url http://localhost:8889" \
641
+ " --yes --server-create-timeout 1800" \
641
642
  " --identity-file #{temp_dir}/openstack.pem"\
642
- " --openstack-ssh-key-id #{@openstack_key_pair}" + get_ssh_credentials_for_windows_image + append_openstack_creds + ' --image-os-type invalid'
643
- }
643
+ " --openstack-ssh-key-id #{@openstack_key_pair}" + get_ssh_credentials_for_windows_image + append_openstack_creds + " --image-os-type invalid"
644
+ end
644
645
 
645
- run_cmd_check_status_and_output('fail', 'ERROR: You must provide --image-os-type option [windows/linux]')
646
+ run_cmd_check_status_and_output("fail", "ERROR: You must provide --image-os-type option [windows/linux]")
646
647
  end
647
648
  end
648
649
  end