knife-openstack 1.3.2 → 2.0.0

Sign up to get free protection for your applications and to get access to all the features.
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,14 +1,15 @@
1
+ # frozen_string_literal: true
1
2
  #
2
3
  # Author:: Siddheshwar More (<siddheshwar.more@clogeny.com>)
3
4
  # Author:: Kaustubh Deorukhkar (<kaustubh@clogeny.com>)
4
5
  # Copyright:: Copyright (c) 2013 Chef Software, Inc.
5
6
  #
6
7
 
7
- require 'chef/knife/cloud/server/delete_options'
8
- require 'chef/knife/cloud/server/delete_command'
9
- require 'chef/knife/cloud/openstack_service'
10
- require 'chef/knife/cloud/openstack_service_options'
11
- require 'chef/knife/openstack_helpers'
8
+ require "chef/knife/cloud/server/delete_options"
9
+ require "chef/knife/cloud/server/delete_command"
10
+ require "chef/knife/cloud/openstack_service"
11
+ require "chef/knife/cloud/openstack_service_options"
12
+ require "chef/knife/openstack_helpers"
12
13
 
13
14
  class Chef
14
15
  class Knife
@@ -18,7 +19,7 @@ class Chef
18
19
  include OpenstackServiceOptions
19
20
  include OpenstackHelpers
20
21
 
21
- banner 'knife openstack server delete INSTANCEID [INSTANCEID] (options)'
22
+ banner "knife openstack server delete INSTANCEID [INSTANCEID] (options)"
22
23
  end
23
24
  end
24
25
  end
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  #
2
3
  # Author:: Seth Chisamore (<schisamo@getchef.com>)
3
4
  # Author:: Matt Ray (<matt@getchef.com>)
@@ -19,10 +20,10 @@
19
20
  # limitations under the License.
20
21
  #
21
22
 
22
- require 'chef/knife/cloud/server/list_command'
23
- require 'chef/knife/openstack_helpers'
24
- require 'chef/knife/cloud/openstack_service_options'
25
- require 'chef/knife/cloud/server/list_options'
23
+ require "chef/knife/cloud/server/list_command"
24
+ require "chef/knife/openstack_helpers"
25
+ require "chef/knife/cloud/openstack_service_options"
26
+ require "chef/knife/cloud/server/list_options"
26
27
 
27
28
  class Chef
28
29
  class Knife
@@ -32,21 +33,21 @@ class Chef
32
33
  include OpenstackServiceOptions
33
34
  include ServerListOptions
34
35
 
35
- banner 'knife openstack server list (options)'
36
+ banner "knife openstack server list (options)"
36
37
 
37
38
  def before_exec_command
38
39
  # set columns_with_info map
39
40
  @columns_with_info = [
40
- { label: 'Name', key: 'name' },
41
- { label: 'Instance ID', key: 'id' },
42
- { label: 'Addresses', key: 'addresses', value_callback: method(:addresses) },
43
- { label: 'Flavor', key: 'flavor', value_callback: method(:get_id) },
44
- { label: 'Image', key: 'image', value_callback: method(:get_id) },
45
- { label: 'Keypair', key: 'key_name' },
46
- { label: 'State', key: 'state' },
47
- { label: 'Availability Zone', key: 'availability_zone' }
41
+ { label: "Name", key: "name" },
42
+ { label: "Instance ID", key: "id" },
43
+ { label: "Addresses", key: "addresses", value_callback: method(:addresses) },
44
+ { label: "Flavor", key: "flavor", value_callback: method(:get_id) },
45
+ { label: "Image", key: "image", value_callback: method(:get_id) },
46
+ { label: "Keypair", key: "key_name" },
47
+ { label: "State", key: "state" },
48
+ { label: "Availability Zone", key: "availability_zone" },
48
49
  ]
49
- @sort_by_field = 'name'
50
+ @sort_by_field = "name"
50
51
  super
51
52
  end
52
53
 
@@ -55,7 +56,7 @@ class Chef
55
56
  end
56
57
 
57
58
  def get_id(value)
58
- value['id']
59
+ value["id"]
59
60
  end
60
61
  end
61
62
  end
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  #
2
3
  # Copyright:: Copyright (c) 2011-2013 Chef Software, Inc.
3
4
  # License:: Apache License, Version 2.0
@@ -15,12 +16,12 @@
15
16
  # limitations under the License.
16
17
  #
17
18
 
18
- require 'chef/knife/cloud/server/show_command'
19
- require 'chef/knife/openstack_helpers'
20
- require 'chef/knife/cloud/server/show_options'
21
- require 'chef/knife/cloud/openstack_service'
22
- require 'chef/knife/cloud/openstack_service_options'
23
- require 'chef/knife/cloud/exceptions'
19
+ require "chef/knife/cloud/server/show_command"
20
+ require "chef/knife/openstack_helpers"
21
+ require "chef/knife/cloud/server/show_options"
22
+ require "chef/knife/cloud/openstack_service"
23
+ require "chef/knife/cloud/openstack_service_options"
24
+ require "chef/knife/cloud/exceptions"
24
25
 
25
26
  class Chef
26
27
  class Knife
@@ -30,25 +31,25 @@ class Chef
30
31
  include OpenstackServiceOptions
31
32
  include ServerShowOptions
32
33
 
33
- banner 'knife openstack server show (options)'
34
+ banner "knife openstack server show (options)"
34
35
 
35
36
  def before_exec_command
36
37
  # set columns_with_info map
37
38
  @columns_with_info = [
38
- { label: 'Instance ID', key: 'id' },
39
- { label: 'Name', key: 'name' },
40
- { label: 'Addresses', key: 'addresses', value_callback: method(:instance_addresses) },
41
- { label: 'Flavor', key: 'flavor', value_callback: method(:get_id) },
42
- { label: 'Image', key: 'image', value_callback: method(:get_id) },
43
- { label: 'Keypair', key: 'key_name' },
44
- { label: 'State', key: 'state' },
45
- { label: 'Availability Zone', key: 'availability_zone' }
39
+ { label: "Instance ID", key: "id" },
40
+ { label: "Name", key: "name" },
41
+ { label: "Addresses", key: "addresses", value_callback: method(:instance_addresses) },
42
+ { label: "Flavor", key: "flavor", value_callback: method(:get_id) },
43
+ { label: "Image", key: "image", value_callback: method(:get_id) },
44
+ { label: "Keypair", key: "key_name" },
45
+ { label: "State", key: "state" },
46
+ { label: "Availability Zone", key: "availability_zone" },
46
47
  ]
47
48
  super
48
49
  end
49
50
 
50
51
  def get_id(value)
51
- value['id']
52
+ value["id"]
52
53
  end
53
54
  end
54
55
  end
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  #
2
3
  # Author:: Seth Chisamore (<schisamo@getchef.com>)
3
4
  # Author:: Matt Ray (<matt@getchef.com>)
@@ -18,9 +19,9 @@
18
19
  # limitations under the License.
19
20
  #
20
21
 
21
- require 'chef/knife/cloud/list_resource_command'
22
- require 'chef/knife/openstack_helpers'
23
- require 'chef/knife/cloud/openstack_service_options'
22
+ require "chef/knife/cloud/list_resource_command"
23
+ require "chef/knife/openstack_helpers"
24
+ require "chef/knife/cloud/openstack_service_options"
24
25
 
25
26
  class Chef
26
27
  class Knife
@@ -29,7 +30,7 @@ class Chef
29
30
  include OpenstackHelpers
30
31
  include OpenstackServiceOptions
31
32
 
32
- banner 'knife openstack volume list (options)'
33
+ banner "knife openstack volume list (options)"
33
34
 
34
35
  def query_resource
35
36
  @service.connection.volumes
@@ -41,11 +42,11 @@ class Chef
41
42
 
42
43
  def list(volumes)
43
44
  volume_list = [
44
- ui.color('Name', :bold),
45
- ui.color('ID', :bold),
46
- ui.color('Status', :bold),
47
- ui.color('Size', :bold),
48
- ui.color('Description', :bold)
45
+ ui.color("Name", :bold),
46
+ ui.color("ID", :bold),
47
+ ui.color("Status", :bold),
48
+ ui.color("Size", :bold),
49
+ ui.color("Description", :bold),
49
50
  ]
50
51
  begin
51
52
  volumes.sort_by(&:name).each do |volume|
@@ -1,6 +1,7 @@
1
+ # frozen_string_literal: true
1
2
  module Knife
2
3
  module OpenStack
3
- VERSION = '1.3.2'
4
- MAJOR, MINOR, TINY = VERSION.split('.')
4
+ VERSION = "2.0.0"
5
+ MAJOR, MINOR, TINY = VERSION.split(".")
5
6
  end
6
7
  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,30 +17,30 @@
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_flavor_list'
21
- require 'chef/knife/cloud/openstack_service'
22
- require 'support/shared_examples_for_command'
20
+ require "spec_helper"
21
+ require "chef/knife/openstack_flavor_list"
22
+ require "chef/knife/cloud/openstack_service"
23
+ require "support/shared_examples_for_command"
23
24
 
24
25
  describe Chef::Knife::Cloud::OpenstackFlavorList do
25
26
  let (:instance) { Chef::Knife::Cloud::OpenstackFlavorList.new }
26
27
 
27
- context 'functionality' do
28
+ context "functionality" do
28
29
  before do
29
- resources = [TestResource.new(id: 'resource-1', name: 'm1.tiny', vcpus: '1', ram: 512, disk: 0),
30
- TestResource.new(id: 'resource-2', name: 'm1-xlarge-bigdisk', vcpus: '8', ram: 16_384, disk: 50)
30
+ resources = [TestResource.new(id: "resource-1", name: "m1.tiny", vcpus: "1", ram: 512, disk: 0),
31
+ TestResource.new(id: "resource-2", name: "m1-xlarge-bigdisk", vcpus: "8", ram: 16_384, disk: 50),
31
32
  ]
32
33
  allow(instance).to receive(:query_resource).and_return(resources)
33
34
  allow(instance).to receive(:puts)
34
35
  allow(instance).to receive(:create_service_instance).and_return(Chef::Knife::Cloud::Service.new)
35
36
  allow(instance).to receive(:validate!)
36
- instance.config[:format] = 'summary'
37
+ instance.config[:format] = "summary"
37
38
  end
38
39
 
39
- it 'lists formatted list of resources' do
40
- expect(instance.ui).to receive(:list).with(['Name', 'ID', 'Virtual CPUs', 'RAM', 'Disk',
41
- 'm1-xlarge-bigdisk', 'resource-2', '8', '16384 MB', '50 GB',
42
- 'm1.tiny', 'resource-1', '1', '512 MB', '0 GB'], :uneven_columns_across, 5)
40
+ it "lists formatted list of resources" do
41
+ expect(instance.ui).to receive(:list).with(["Name", "ID", "Virtual CPUs", "RAM", "Disk",
42
+ "m1-xlarge-bigdisk", "resource-2", "8", "16384 MB", "50 GB",
43
+ "m1.tiny", "resource-1", "1", "512 MB", "0 GB"], :uneven_columns_across, 5)
43
44
  instance.run
44
45
  end
45
46
  end
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  #
2
3
  # Author:: Vasundhara Jagdale (<vasundhara.jagdale@clogeny.com>)
3
4
  # Copyright:: Copyright (c) 2013-2014 Chef Software, Inc.
@@ -15,32 +16,32 @@
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_floating_ip_list'
20
- require 'chef/knife/cloud/openstack_service'
21
- require 'support/shared_examples_for_command'
19
+ require "spec_helper"
20
+ require "chef/knife/openstack_floating_ip_list"
21
+ require "chef/knife/cloud/openstack_service"
22
+ require "support/shared_examples_for_command"
22
23
 
23
24
  describe Chef::Knife::Cloud::OpenstackFloatingIpList do
24
25
  let (:instance) { Chef::Knife::Cloud::OpenstackFloatingIpList.new }
25
26
 
26
- context 'functionality' do
27
+ context "functionality" do
27
28
  before do
28
- resources = [TestResource.new('id' => 'floatingip1', 'instance_id' => 'daed9e86-4b69-4242-993a-926a39352783', 'ip' => '173.236.251.98', 'fixed_ip' => '', 'pool' => 'test-pool'
29
+ resources = [TestResource.new("id" => "floatingip1", "instance_id" => "daed9e86-4b69-4242-993a-926a39352783", "ip" => "173.236.251.98", "fixed_ip" => "", "pool" => "test-pool"
30
+ ),
31
+ TestResource.new("id" => "floatingip2", "instance_id" => "", "ip" => "67.205.60.122", "fixed_ip" => "10.10.10.1", "pool" => "test-pool"
29
32
  ),
30
- TestResource.new('id' => 'floatingip2', 'instance_id' => '', 'ip' => '67.205.60.122', 'fixed_ip' => '10.10.10.1', 'pool' => 'test-pool'
31
- )
32
33
  ]
33
34
  allow(instance).to receive(:query_resource).and_return(resources)
34
35
  allow(instance).to receive(:puts)
35
36
  allow(instance).to receive(:create_service_instance).and_return(Chef::Knife::Cloud::Service.new)
36
37
  allow(instance).to receive(:validate!)
37
- instance.config[:format] = 'summary'
38
+ instance.config[:format] = "summary"
38
39
  end
39
40
 
40
- it 'lists formatted list of resources' do
41
- expect(instance.ui).to receive(:list).with(['ID', 'Instance ID', 'IP Address', 'Fixed IP', 'Floating IP Pool',
42
- 'floatingip1', 'daed9e86-4b69-4242-993a-926a39352783', '173.236.251.98', '', 'test-pool',
43
- 'floatingip2', '', '67.205.60.122', '10.10.10.1', 'test-pool'], :uneven_columns_across, 5)
41
+ it "lists formatted list of resources" do
42
+ expect(instance.ui).to receive(:list).with(["ID", "Instance ID", "IP Address", "Fixed IP", "Floating IP Pool",
43
+ "floatingip1", "daed9e86-4b69-4242-993a-926a39352783", "173.236.251.98", "", "test-pool",
44
+ "floatingip2", "", "67.205.60.122", "10.10.10.1", "test-pool"], :uneven_columns_across, 5)
44
45
  instance.run
45
46
  end
46
47
  end
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  #
2
3
  # Author:: Mukta Aphale (<mukta.aphale@clogeny.com>)
3
4
  # Author:: Prabhu Das (<prabhu.das@clogeny.com>)
@@ -17,47 +18,47 @@
17
18
  # See the License for the specific language governing permissions and
18
19
  # limitations under the License.
19
20
 
20
- require 'spec_helper'
21
- require 'chef/knife/openstack_group_list'
22
- require 'chef/knife/cloud/openstack_service'
21
+ require "spec_helper"
22
+ require "chef/knife/openstack_group_list"
23
+ require "chef/knife/cloud/openstack_service"
23
24
 
24
25
  describe Chef::Knife::Cloud::OpenstackGroupList do
25
26
  let (:instance) { Chef::Knife::Cloud::OpenstackGroupList.new }
26
27
 
27
- context 'functionality' do
28
+ context "functionality" do
28
29
  before do
29
- resources = [TestResource.new('name' => 'Unrestricted',
30
- 'description' => 'All ports open',
31
- 'security_group_rules' => [TestResource.new('from_port' => 1,
32
- 'group' => {},
33
- 'ip_protocol' => 'tcp',
34
- 'to_port' => 636,
35
- 'parent_group_id' => 14,
36
- 'ip_range' => { 'cidr' => '0.0.0.0/0' },
37
- 'id' => 1)
30
+ resources = [TestResource.new("name" => "Unrestricted",
31
+ "description" => "All ports open",
32
+ "security_group_rules" => [TestResource.new("from_port" => 1,
33
+ "group" => {},
34
+ "ip_protocol" => "tcp",
35
+ "to_port" => 636,
36
+ "parent_group_id" => 14,
37
+ "ip_range" => { "cidr" => "0.0.0.0/0" },
38
+ "id" => 1),
39
+ ]),
40
+ TestResource.new("name" => "WindowsDomain",
41
+ "description" => "Allows common protocols useful in a Windows domain",
42
+ "security_group_rules" => [TestResource.new("from_port" => 22,
43
+ "group" => {},
44
+ "ip_protocol" => "tcp",
45
+ "to_port" => 636,
46
+ "parent_group_id" => 14,
47
+ "ip_range" => { "cidr" => "0.0.0.0/0" },
48
+ "id" => 2),
38
49
  ]),
39
- TestResource.new('name' => 'WindowsDomain',
40
- 'description' => 'Allows common protocols useful in a Windows domain',
41
- 'security_group_rules' => [TestResource.new('from_port' => 22,
42
- 'group' => {},
43
- 'ip_protocol' => 'tcp',
44
- 'to_port' => 636,
45
- 'parent_group_id' => 14,
46
- 'ip_range' => { 'cidr' => '0.0.0.0/0' },
47
- 'id' => 2)
48
- ])
49
50
  ]
50
51
  allow(instance).to receive(:query_resource).and_return(resources)
51
52
  allow(instance).to receive(:puts)
52
53
  allow(instance).to receive(:create_service_instance).and_return(Chef::Knife::Cloud::Service.new)
53
54
  allow(instance).to receive(:validate!)
54
- instance.config[:format] = 'summary'
55
+ instance.config[:format] = "summary"
55
56
  end
56
57
 
57
- it 'lists formatted list of resources' do
58
- expect(instance.ui).to receive(:list).with(['Name', 'Protocol', 'From', 'To', 'CIDR', 'Description',
59
- 'Unrestricted', 'tcp', '1', '636', '0.0.0.0/0', 'All ports open',
60
- 'WindowsDomain', 'tcp', '22', '636', '0.0.0.0/0', 'Allows common protocols useful in a Windows domain'], :uneven_columns_across, 6)
58
+ it "lists formatted list of resources" do
59
+ expect(instance.ui).to receive(:list).with(["Name", "Protocol", "From", "To", "CIDR", "Description",
60
+ "Unrestricted", "tcp", "1", "636", "0.0.0.0/0", "All ports open",
61
+ "WindowsDomain", "tcp", "22", "636", "0.0.0.0/0", "Allows common protocols useful in a Windows domain"], :uneven_columns_across, 6)
61
62
  instance.run
62
63
  end
63
64
  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,36 +17,36 @@
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_image_list'
21
- require 'chef/knife/cloud/openstack_service'
20
+ require "spec_helper"
21
+ require "chef/knife/openstack_image_list"
22
+ require "chef/knife/cloud/openstack_service"
22
23
 
23
24
  describe Chef::Knife::Cloud::OpenstackImageList do
24
25
  let (:instance) { Chef::Knife::Cloud::OpenstackImageList.new }
25
26
 
26
- context 'functionality' do
27
+ context "functionality" do
27
28
  before do
28
- resources = [TestResource.new(id: 'resource-1', name: 'image01', metadata: {}),
29
- TestResource.new(id: 'resource-2', name: 'initrd', metadata: {})
29
+ resources = [TestResource.new(id: "resource-1", name: "image01", metadata: {}),
30
+ TestResource.new(id: "resource-2", name: "initrd", metadata: {}),
30
31
  ]
31
32
  allow(instance).to receive(:query_resource).and_return(resources)
32
33
  allow(instance).to receive(:puts)
33
34
  allow(instance).to receive(:create_service_instance).and_return(Chef::Knife::Cloud::Service.new)
34
35
  allow(instance).to receive(:validate!)
35
- instance.config[:format] = 'summary'
36
+ instance.config[:format] = "summary"
36
37
  end
37
38
 
38
- it 'displays formatted list of images, filtered by default' do
39
- expect(instance.ui).to receive(:list).with(['Name', 'ID', 'Snapshot',
40
- 'image01', 'resource-1', 'no'], :uneven_columns_across, 3)
39
+ it "displays formatted list of images, filtered by default" do
40
+ expect(instance.ui).to receive(:list).with(["Name", "ID", "Snapshot",
41
+ "image01", "resource-1", "no"], :uneven_columns_across, 3)
41
42
  instance.run
42
43
  end
43
44
 
44
- it 'lists all images when disable_filter = true' do
45
+ it "lists all images when disable_filter = true" do
45
46
  instance.config[:disable_filter] = true
46
- expect(instance.ui).to receive(:list).with(['Name', 'ID', 'Snapshot',
47
- 'image01', 'resource-1', 'no',
48
- 'initrd', 'resource-2', 'no'], :uneven_columns_across, 3)
47
+ expect(instance.ui).to receive(:list).with(["Name", "ID", "Snapshot",
48
+ "image01", "resource-1", "no",
49
+ "initrd", "resource-2", "no"], :uneven_columns_across, 3)
49
50
  instance.run
50
51
  end
51
52
  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) 2014 Chef Software, Inc.
@@ -15,30 +16,30 @@
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_network_list'
20
- require 'chef/knife/cloud/openstack_service'
21
- require 'support/shared_examples_for_command'
19
+ require "spec_helper"
20
+ require "chef/knife/openstack_network_list"
21
+ require "chef/knife/cloud/openstack_service"
22
+ require "support/shared_examples_for_command"
22
23
 
23
24
  describe Chef::Knife::Cloud::OpenstackNetworkList do
24
25
  let (:instance) { Chef::Knife::Cloud::OpenstackNetworkList.new }
25
26
 
26
- context 'functionality' do
27
+ context "functionality" do
27
28
  before do
28
- resources = [TestResource.new(id: 'resource-1', name: 'external', tenant_id: '1', shared: true),
29
- TestResource.new(id: 'resource-2', name: 'internal', tenant_id: '2', shared: false)
29
+ resources = [TestResource.new(id: "resource-1", name: "external", tenant_id: "1", shared: true),
30
+ TestResource.new(id: "resource-2", name: "internal", tenant_id: "2", shared: false),
30
31
  ]
31
32
  allow(instance).to receive(:query_resource).and_return(resources)
32
33
  allow(instance).to receive(:puts)
33
34
  allow(instance).to receive(:create_service_instance).and_return(Chef::Knife::Cloud::Service.new)
34
35
  allow(instance).to receive(:validate!)
35
- instance.config[:format] = 'summary'
36
+ instance.config[:format] = "summary"
36
37
  end
37
38
 
38
- it 'lists formatted list of network resources' do
39
- expect(instance.ui).to receive(:list).with(['Name', 'ID', 'Tenant', 'Shared',
40
- 'external', 'resource-1', '1', 'true',
41
- 'internal', 'resource-2', '2', 'false'], :uneven_columns_across, 4)
39
+ it "lists formatted list of network resources" do
40
+ expect(instance.ui).to receive(:list).with(["Name", "ID", "Tenant", "Shared",
41
+ "external", "resource-1", "1", "true",
42
+ "internal", "resource-2", "2", "false"], :uneven_columns_across, 4)
42
43
  instance.run
43
44
  end
44
45
  end