knife-cloud 1.2.1 → 1.2.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (68) hide show
  1. checksums.yaml +5 -5
  2. data/LICENSE +1 -1
  3. data/lib/chef/knife/cloud/chefbootstrap/bootstrap_distribution.rb +2 -2
  4. data/lib/chef/knife/cloud/chefbootstrap/bootstrap_options.rb +115 -133
  5. data/lib/chef/knife/cloud/chefbootstrap/bootstrap_protocol.rb +6 -6
  6. data/lib/chef/knife/cloud/chefbootstrap/bootstrapper.rb +11 -12
  7. data/lib/chef/knife/cloud/chefbootstrap/ssh_bootstrap_protocol.rb +49 -54
  8. data/lib/chef/knife/cloud/chefbootstrap/unix_distribution.rb +3 -3
  9. data/lib/chef/knife/cloud/chefbootstrap/windows_distribution.rb +3 -3
  10. data/lib/chef/knife/cloud/chefbootstrap/winrm_bootstrap_protocol.rb +11 -12
  11. data/lib/chef/knife/cloud/command.rb +24 -27
  12. data/lib/chef/knife/cloud/exceptions.rb +1 -2
  13. data/lib/chef/knife/cloud/fog/options.rb +8 -8
  14. data/lib/chef/knife/cloud/fog/service.rb +54 -60
  15. data/lib/chef/knife/cloud/helpers.rb +2 -3
  16. data/lib/chef/knife/cloud/list_resource_command.rb +6 -7
  17. data/lib/chef/knife/cloud/list_resource_options.rb +5 -5
  18. data/lib/chef/knife/cloud/server/create_command.rb +30 -35
  19. data/lib/chef/knife/cloud/server/create_options.rb +33 -34
  20. data/lib/chef/knife/cloud/server/delete_command.rb +12 -15
  21. data/lib/chef/knife/cloud/server/delete_options.rb +7 -8
  22. data/lib/chef/knife/cloud/server/list_command.rb +22 -22
  23. data/lib/chef/knife/cloud/server/list_options.rb +9 -10
  24. data/lib/chef/knife/cloud/server/options.rb +7 -7
  25. data/lib/chef/knife/cloud/server/show_command.rb +5 -5
  26. data/lib/chef/knife/cloud/server/show_options.rb +5 -6
  27. data/lib/chef/knife/cloud/service.rb +12 -13
  28. data/lib/knife-cloud/version.rb +2 -2
  29. data/lib/test/fixtures/knife.rb +3 -3
  30. data/lib/test/fixtures/validation.pem +27 -0
  31. data/lib/test/knife-utils/helper.rb +11 -11
  32. data/lib/test/knife-utils/knife_test_utils.rb +4 -4
  33. data/lib/test/knife-utils/matchers.rb +3 -3
  34. data/lib/test/knife-utils/test_bed.rb +38 -38
  35. data/lib/test/templates/windows-chef-client-msi.erb +3 -4
  36. data/lib/test/templates/windows-shell.erb +2 -2
  37. metadata +12 -152
  38. data/.gitignore +0 -33
  39. data/.travis.yml +0 -6
  40. data/CHANGELOG.md +0 -133
  41. data/CONTRIBUTING.md +0 -5
  42. data/Gemfile +0 -9
  43. data/README.md +0 -421
  44. data/Rakefile +0 -35
  45. data/ci.gemfile +0 -18
  46. data/knife-cloud.gemspec +0 -26
  47. data/spec/resource_spec_helper.rb +0 -49
  48. data/spec/server_command_common_spec_helper.rb +0 -48
  49. data/spec/spec_helper.rb +0 -25
  50. data/spec/support/shared_examples_for_command.rb +0 -35
  51. data/spec/support/shared_examples_for_servercreatecommand.rb +0 -144
  52. data/spec/support/shared_examples_for_serverdeletecommand.rb +0 -77
  53. data/spec/support/shared_examples_for_service.rb +0 -85
  54. data/spec/unit/bootstrap_protocol_spec.rb +0 -98
  55. data/spec/unit/bootstrapper_spec.rb +0 -171
  56. data/spec/unit/cloud_command_spec.rb +0 -35
  57. data/spec/unit/command_spec.rb +0 -49
  58. data/spec/unit/fog_service_spec.rb +0 -163
  59. data/spec/unit/list_resource_command_spec.rb +0 -140
  60. data/spec/unit/server_create_command_spec.rb +0 -198
  61. data/spec/unit/server_delete_command_spec.rb +0 -25
  62. data/spec/unit/server_list_command_spec.rb +0 -119
  63. data/spec/unit/server_show_command_spec.rb +0 -64
  64. data/spec/unit/service_spec.rb +0 -46
  65. data/spec/unit/ssh_bootstrap_protocol_spec.rb +0 -116
  66. data/spec/unit/unix_distribution_spec.rb +0 -37
  67. data/spec/unit/windows_distribution_spec.rb +0 -37
  68. data/spec/unit/winrm_bootstrap_protocol_spec.rb +0 -108
@@ -1,5 +1,5 @@
1
1
  #
2
- # Copyright:: Copyright (c) 2013 Opscode, Inc.
2
+ # Copyright:: Copyright (c) 2013-2016 Chef Software, Inc.
3
3
  # License:: Apache License, Version 2.0
4
4
  #
5
5
  # Licensed under the Apache License, Version 2.0 (the "License");
@@ -21,7 +21,7 @@ class Chef
21
21
  module Helpers
22
22
 
23
23
  # Additional helpers
24
- def msg_pair(label, value, color=:cyan)
24
+ def msg_pair(label, value, color = :cyan)
25
25
  if value && !value.to_s.empty?
26
26
  puts "#{ui.color(label, color)}: #{value}"
27
27
  end
@@ -36,4 +36,3 @@ class Chef
36
36
  end
37
37
  end
38
38
  end
39
-
@@ -16,14 +16,14 @@
16
16
  # limitations under the License.
17
17
  #
18
18
 
19
- require 'chef/knife/cloud/command'
19
+ require "chef/knife/cloud/command"
20
20
 
21
21
  class Chef
22
22
  class Knife
23
23
  class Cloud
24
24
  class ResourceListCommand < Command
25
25
 
26
- def initialize(argv=[])
26
+ def initialize(argv = [])
27
27
  super argv
28
28
  # columns_with_info is array of hash with label, key and attribute extraction callback, ex [{:label => "Label text", :key => 'key', value_callback => callback_method to extract/format the required value}, ...]
29
29
  @columns_with_info = []
@@ -40,14 +40,14 @@ class Chef
40
40
 
41
41
  def query_resource
42
42
  # specific resource type must override this.
43
- raise Chef::Exceptions::Override, "You must override query_resource in #{self.to_s} to return resources."
43
+ raise Chef::Exceptions::Override, "You must override query_resource in #{self} to return resources."
44
44
  end
45
45
 
46
46
  def is_resource_filtered?(attribute, value)
47
47
  # resource_filters is array of filters in form {:attribute => attribute-name, :regex => 'filter regex value'}
48
48
  return false if @resource_filters.nil?
49
49
  @resource_filters.each do |filter|
50
- if attribute == filter[:attribute] and value =~ filter[:regex]
50
+ if attribute == filter[:attribute] && value =~ filter[:regex]
51
51
  return true
52
52
  end
53
53
  end
@@ -70,11 +70,11 @@ class Chef
70
70
 
71
71
  # When @columns_with_info is nil display all
72
72
  def list(resources)
73
- if(config[:format] == "summary")
73
+ if config[:format] == "summary"
74
74
  # display column wise only if @columns_with_info is specified, else as a json for readable display.
75
75
  begin
76
76
  resource_list = @columns_with_info.map { |col_info| ui.color(col_info[:label], :bold) } if @columns_with_info.length > 0
77
- resources.sort_by{|x| x.send(@sort_by_field).downcase }.each do |resource|
77
+ resources.sort_by { |x| x.send(@sort_by_field).downcase }.each do |resource|
78
78
  if @columns_with_info.length > 0
79
79
  list = get_resource_col_val(resource)
80
80
  resource_list.concat(list) unless list.nil?
@@ -99,4 +99,3 @@ class Chef
99
99
  end
100
100
  end
101
101
  end
102
-
@@ -8,14 +8,14 @@ class Chef
8
8
  includer.class_eval do
9
9
 
10
10
  option :disable_filter,
11
- :long => "--disable-filter",
12
- :description => "Disable filtering of the current resource listing.",
13
- :boolean => true,
14
- :default => false
11
+ long: "--disable-filter",
12
+ description: "Disable filtering of the current resource listing.",
13
+ boolean: true,
14
+ default: false
15
15
  end
16
16
  end
17
17
 
18
18
  end
19
19
  end
20
20
  end
21
- end
21
+ end
@@ -1,5 +1,5 @@
1
1
  #
2
- # Copyright:: Copyright (c) 2013 Opscode, Inc.
2
+ # Copyright:: Copyright (c) 2013-2016 Chef Software, Inc.
3
3
  # License:: Apache License, Version 2.0
4
4
  #
5
5
  # Licensed under the Apache License, Version 2.0 (the "License");
@@ -14,9 +14,9 @@
14
14
  # See the License for the specific language governing permissions and
15
15
  # limitations under the License.
16
16
  #
17
- require 'chef/knife/cloud/command'
18
- require 'chef/knife/cloud/exceptions'
19
- require 'chef/knife/cloud/chefbootstrap/bootstrapper'
17
+ require "chef/knife/cloud/command"
18
+ require "chef/knife/cloud/exceptions"
19
+ require "chef/knife/cloud/chefbootstrap/bootstrapper"
20
20
 
21
21
  class Chef
22
22
  class Knife
@@ -24,7 +24,7 @@ class Chef
24
24
  class ServerCreateCommand < Command
25
25
  attr_accessor :server, :create_options
26
26
 
27
- def initialize(argv=[])
27
+ def initialize(argv = [])
28
28
  super argv
29
29
  # columns_with_info is array of hash with label, key and attribute extraction callback, ex [{:label => "Label text", :key => 'key', value_callback => callback_method to extract/format the required value}, ...]
30
30
  @columns_with_info = []
@@ -37,11 +37,11 @@ class Chef
37
37
  # validate ssh_user, ssh_password, identity_file for ssh bootstrap protocol and winrm_password for winrm bootstrap protocol
38
38
  errors = []
39
39
 
40
- if locate_config_value(:bootstrap_protocol) == 'ssh'
40
+ if locate_config_value(:bootstrap_protocol) == "ssh"
41
41
  if locate_config_value(:identity_file).nil? && locate_config_value(:ssh_password).nil?
42
42
  errors << "You must provide either Identity file or SSH Password."
43
43
  end
44
- elsif locate_config_value(:bootstrap_protocol) == 'winrm'
44
+ elsif locate_config_value(:bootstrap_protocol) == "winrm"
45
45
  if locate_config_value(:winrm_password).nil?
46
46
  errors << "You must provide Winrm Password."
47
47
  end
@@ -49,18 +49,16 @@ class Chef
49
49
  errors << "You must provide a valid bootstrap protocol. options [ssh/winrm]. For linux type images, options [ssh]"
50
50
  end
51
51
  error_message = ""
52
- raise CloudExceptions::ValidationError, error_message if errors.each{|e| ui.error(e); error_message = "#{error_message} #{e}."}.any?
52
+ raise CloudExceptions::ValidationError, error_message if errors.each { |e| ui.error(e); error_message = "#{error_message} #{e}." }.any?
53
53
  end
54
54
 
55
55
  def before_exec_command
56
- begin
57
- post_connection_validations
58
- service.create_server_dependencies
59
- rescue CloudExceptions::ServerCreateDependenciesError => e
60
- ui.fatal(e.message)
61
- service.delete_server_dependencies
62
- raise e
63
- end
56
+ post_connection_validations
57
+ service.create_server_dependencies
58
+ rescue CloudExceptions::ServerCreateDependenciesError => e
59
+ ui.fatal(e.message)
60
+ service.delete_server_dependencies
61
+ raise e
64
62
  end
65
63
 
66
64
  def execute_command
@@ -77,19 +75,17 @@ class Chef
77
75
 
78
76
  # Derived classes can override after_exec_command and also call cleanup_on_failure if any exception occured.
79
77
  def after_exec_command
80
- begin
81
78
  # bootstrap the server
82
- bootstrap
83
- rescue CloudExceptions::BootstrapError => e
84
- ui.fatal(e.message)
85
- cleanup_on_failure
86
- raise e
87
- rescue => e
88
- error_message = "Check if --bootstrap-protocol and --image-os-type is correct. #{e.message}"
89
- ui.fatal(error_message)
90
- cleanup_on_failure
91
- raise e, error_message
92
- end
79
+ bootstrap
80
+ rescue CloudExceptions::BootstrapError => e
81
+ ui.fatal(e.message)
82
+ cleanup_on_failure
83
+ raise e
84
+ rescue => e
85
+ error_message = "Check if --bootstrap-protocol and --image-os-type is correct. #{e.message}"
86
+ ui.fatal(error_message)
87
+ cleanup_on_failure
88
+ raise e, error_message
93
89
  end
94
90
 
95
91
  def cleanup_on_failure
@@ -111,7 +107,7 @@ class Chef
111
107
 
112
108
  # any cloud specific initializations/cleanup we want to do around bootstrap.
113
109
  def before_bootstrap
114
- ssh_override_winrm if locate_config_value(:bootstrap_protocol) == 'ssh'
110
+ ssh_override_winrm if locate_config_value(:bootstrap_protocol) == "ssh"
115
111
  end
116
112
 
117
113
  def after_bootstrap
@@ -120,14 +116,14 @@ class Chef
120
116
 
121
117
  # knife-plugin can override set_default_config to set default config by using their own mechanism.
122
118
  def set_default_config
123
- config[:image_os_type] = 'windows' if config[:bootstrap_protocol] == 'winrm'
119
+ config[:image_os_type] = "windows" if config[:bootstrap_protocol] == "winrm"
124
120
  end
125
121
 
126
- #generate a random name if chef_node_name is empty
122
+ # generate a random name if chef_node_name is empty
127
123
  def get_node_name(chef_node_name, prefix)
128
124
  return chef_node_name unless chef_node_name.nil?
129
- #lazy uuids, 15 chars cause windows has limits
130
- chef_node_name = ("#{prefix}-"+rand.to_s.split('.')[1]).slice(0,14)
125
+ # lazy uuids, 15 chars cause windows has limits
126
+ ("#{prefix}-" + rand.to_s.split(".")[1]).slice(0, 14)
131
127
  end
132
128
 
133
129
  def post_connection_validations
@@ -156,10 +152,9 @@ class Chef
156
152
  if locate_config_value(:identity_file).nil? &&
157
153
  !locate_config_value(:kerberos_keytab_file).nil?
158
154
  config[:identity_file] = locate_config_value(:kerberos_keytab_file)
159
- end
155
+ end
160
156
  end
161
157
  end # class ServerCreateCommand
162
158
  end
163
159
  end
164
160
  end
165
-
@@ -1,5 +1,5 @@
1
1
  #
2
- # Copyright:: Copyright (c) 2013 Opscode, Inc.
2
+ # Copyright:: Copyright (c) 2013-2016 Chef Software, Inc.
3
3
  # License:: Apache License, Version 2.0
4
4
  #
5
5
  # Licensed under the Apache License, Version 2.0 (the "License");
@@ -15,8 +15,8 @@
15
15
  # limitations under the License.
16
16
  #
17
17
 
18
- require 'chef/knife/cloud/chefbootstrap/bootstrap_options'
19
- require 'chef/knife/cloud/server/options'
18
+ require "chef/knife/cloud/chefbootstrap/bootstrap_options"
19
+ require "chef/knife/cloud/server/options"
20
20
 
21
21
  class Chef
22
22
  class Knife
@@ -28,47 +28,47 @@ class Chef
28
28
  include ServerOptions
29
29
  include BootstrapOptions
30
30
  option :image,
31
- :short => "-I IMAGE",
32
- :long => "--image IMAGE",
33
- :description => "A regexp matching an image name or an image ID for the server",
34
- :proc => Proc.new { |i| Chef::Config[:knife][:image] = i }
31
+ short: "-I IMAGE",
32
+ long: "--image IMAGE",
33
+ description: "A regexp matching an image name or an image ID for the server",
34
+ proc: Proc.new { |i| Chef::Config[:knife][:image] = i }
35
35
 
36
36
  option :image_os_type,
37
- :short => "-T IMAGE_OS_TYPE",
38
- :long => "--image-os-type IMAGE_OS_TYPE",
39
- :description => "The image os type. options [windows/linux]. Only required when cloud does not provide a way to identify image os",
40
- :default => "linux",
41
- :proc => Proc.new { |i| Chef::Config[:knife][:image_os_type] = i }
37
+ short: "-T IMAGE_OS_TYPE",
38
+ long: "--image-os-type IMAGE_OS_TYPE",
39
+ description: "The image os type. options [windows/linux]. Only required when cloud does not provide a way to identify image os",
40
+ default: "linux",
41
+ proc: Proc.new { |i| Chef::Config[:knife][:image_os_type] = i }
42
42
 
43
43
  option :flavor,
44
- :short => "-f FLAVOR_ID",
45
- :long => "--flavor FLAVOR_ID",
46
- :description => "The flavor name or ID of server",
47
- :proc => Proc.new { |f| Chef::Config[:knife][:flavor] = f }
44
+ short: "-f FLAVOR_ID",
45
+ long: "--flavor FLAVOR_ID",
46
+ description: "The flavor name or ID of server",
47
+ proc: Proc.new { |f| Chef::Config[:knife][:flavor] = f }
48
48
 
49
49
  option :bootstrap_protocol,
50
- :long => "--bootstrap-protocol protocol",
51
- :description => "Protocol to bootstrap servers. options: winrm/ssh. For linux servers always use ssh.",
52
- :default => 'ssh',
53
- :proc => Proc.new { |b| Chef::Config[:knife][:bootstrap_protocol] = b}
50
+ long: "--bootstrap-protocol protocol",
51
+ description: "Protocol to bootstrap servers. options: winrm/ssh. For linux servers always use ssh.",
52
+ default: "ssh",
53
+ proc: Proc.new { |b| Chef::Config[:knife][:bootstrap_protocol] = b }
54
54
 
55
55
  option :server_create_timeout,
56
- :long => "--server-create-timeout timeout",
57
- :description => "How long to wait until the server is ready; default is 600 seconds",
58
- :default => 600,
59
- :proc => Proc.new { |v| Chef::Config[:knife][:server_create_timeout] = v}
60
-
56
+ long: "--server-create-timeout timeout",
57
+ description: "How long to wait until the server is ready; default is 600 seconds",
58
+ default: 600,
59
+ proc: Proc.new { |v| Chef::Config[:knife][:server_create_timeout] = v }
60
+
61
61
  option :delete_server_on_failure,
62
- :long => "--delete-server-on-failure",
63
- :boolean => true,
64
- :default => false,
65
- :description => "Destroy corresponding server in case of failure"
62
+ long: "--delete-server-on-failure",
63
+ boolean: true,
64
+ default: false,
65
+ description: "Destroy corresponding server in case of failure"
66
66
 
67
67
  option :chef_node_name_prefix,
68
- :long => "--chef-node-name-prefix PREFIX_FOR_NODE_NAME",
69
- :description => "The prefix for chef node name",
70
- :default => includer.snake_case_name.split('_').first,
71
- :proc => Proc.new { |key| Chef::Config[:knife][:chef_node_name_prefix] = key }
68
+ long: "--chef-node-name-prefix PREFIX_FOR_NODE_NAME",
69
+ description: "The prefix for chef node name",
70
+ default: includer.snake_case_name.split("_").first,
71
+ proc: Proc.new { |key| Chef::Config[:knife][:chef_node_name_prefix] = key }
72
72
 
73
73
  end
74
74
  end
@@ -77,4 +77,3 @@ class Chef
77
77
  end
78
78
  end
79
79
  end
80
-
@@ -1,6 +1,6 @@
1
1
  #
2
2
  # Author:: Kaustubh Deorukhkar (<kaustubh@clogeny.com>)
3
- # Copyright:: Copyright (c) 2013 Opscode, Inc.
3
+ # Copyright:: Copyright (c) 2013-2016 Chef Software, Inc.
4
4
  # License:: Apache License, Version 2.0
5
5
  #
6
6
  # Licensed under the Apache License, Version 2.0 (the "License");
@@ -16,10 +16,10 @@
16
16
  # limitations under the License.
17
17
  #
18
18
 
19
- require 'chef/knife/cloud/command'
19
+ require "chef/knife/cloud/command"
20
20
  # These two are needed for the '--purge' deletion case
21
- require 'chef/node'
22
- require 'chef/api_client'
21
+ require "chef/node"
22
+ require "chef/api_client"
23
23
 
24
24
  class Chef
25
25
  class Knife
@@ -41,7 +41,7 @@ class Chef
41
41
  destroy_item(Chef::ApiClient, thing_to_delete, "client")
42
42
  else
43
43
  ui.warn("Corresponding node and client for the #{server_name} server were not deleted and remain registered with the Chef Server")
44
- end
44
+ end
45
45
  end
46
46
 
47
47
  # Extracted from Chef::Knife.delete_object, because it has a
@@ -50,19 +50,16 @@ class Chef
50
50
  # the user is already making their intent known. It is not
51
51
  # necessary to make them confirm two more times.
52
52
  def destroy_item(klass, name, type_name)
53
- begin
54
- object = klass.load(name)
55
- object.destroy
56
- ui.warn("Deleted #{type_name} #{name}")
57
- rescue Net::HTTPServerException => e
58
- error_message = "#{e.message}. Could not find a #{type_name} named #{name} to delete!"
59
- ui.warn(error_message)
60
- raise CloudExceptions::ServerDeleteError, error_message
61
- end
53
+ object = klass.load(name)
54
+ object.destroy
55
+ ui.warn("Deleted #{type_name} #{name}")
56
+ rescue Net::HTTPServerException => e
57
+ error_message = "#{e.message}. Could not find a #{type_name} named #{name} to delete!"
58
+ ui.warn(error_message)
59
+ raise CloudExceptions::ServerDeleteError, error_message
62
60
  end
63
61
 
64
62
  end # class ServerDeleteCommand
65
63
  end
66
64
  end
67
65
  end
68
-
@@ -1,6 +1,6 @@
1
1
  #
2
2
  # Author:: Kaustubh Deorukhkar (<kaustubh@clogeny.com>)
3
- # Copyright:: Copyright (c) 2013 Opscode, Inc.
3
+ # Copyright:: Copyright (c) 2013-2016 Chef Software, Inc.
4
4
  # License:: Apache License, Version 2.0
5
5
  #
6
6
  # Licensed under the Apache License, Version 2.0 (the "License");
@@ -16,7 +16,7 @@
16
16
  # limitations under the License.
17
17
  #
18
18
 
19
- require 'chef/knife/cloud/server/options'
19
+ require "chef/knife/cloud/server/options"
20
20
 
21
21
  class Chef
22
22
  class Knife
@@ -27,11 +27,11 @@ class Chef
27
27
  include ServerOptions
28
28
 
29
29
  option :purge,
30
- :short => "-P",
31
- :long => "--purge",
32
- :boolean => true,
33
- :default => false,
34
- :description => "Destroy corresponding node and client on the Chef Server, in addition to destroying the Cloud node itself. Assumes node and client have the same name as the server (if not, add the '--node-name' option)."
30
+ short: "-P",
31
+ long: "--purge",
32
+ boolean: true,
33
+ default: false,
34
+ description: "Destroy corresponding node and client on the Chef Server, in addition to destroying the Cloud node itself. Assumes node and client have the same name as the server (if not, add the '--node-name' option)."
35
35
 
36
36
  end
37
37
  end
@@ -39,4 +39,3 @@ class Chef
39
39
  end
40
40
  end
41
41
  end
42
-
@@ -1,11 +1,11 @@
1
- require 'chef/knife/cloud/list_resource_command'
2
- require 'chef/knife/cloud/exceptions'
1
+ require "chef/knife/cloud/list_resource_command"
2
+ require "chef/knife/cloud/exceptions"
3
3
 
4
4
  class Chef
5
5
  class Knife
6
6
  class Cloud
7
7
  class ServerListCommand < ResourceListCommand
8
-
8
+
9
9
  def before_exec_command
10
10
  if config[:chef_data]
11
11
  begin
@@ -16,18 +16,18 @@ class Chef
16
16
  ui.warn(error_message)
17
17
  raise CloudExceptions::ChefServerError, error_message
18
18
  end
19
-
19
+
20
20
  @chef_data_col_info = [
21
- {:label => 'Chef Node Name', :key => 'name'},
22
- {:label => 'Environment', :key => 'chef_environment'},
23
- {:label => 'FQDN', :key => 'fqdn'},
24
- {:label => 'Runlist', :key => 'run_list'},
25
- {:label => 'Tags', :key => 'tags'},
26
- {:label => 'Platform', :key => 'platform'},
21
+ { label: "Chef Node Name", key: "name" },
22
+ { label: "Environment", key: "chef_environment" },
23
+ { label: "FQDN", key: "fqdn" },
24
+ { label: "Runlist", key: "run_list" },
25
+ { label: "Tags", key: "tags" },
26
+ { label: "Platform", key: "platform" },
27
27
  ]
28
28
 
29
29
  if config[:chef_node_attribute]
30
- @chef_data_col_info << {:label => "#{config[:chef_node_attribute]}", :key => "#{config[:chef_node_attribute]}"}
30
+ @chef_data_col_info << { label: "#{config[:chef_node_attribute]}", key: "#{config[:chef_node_attribute]}" }
31
31
  end
32
32
  @columns_with_info.concat(@chef_data_col_info)
33
33
  end
@@ -40,7 +40,7 @@ class Chef
40
40
  if config[:chef_data] && @chef_data_col_info.include?(col_info)
41
41
  server_name = service.get_server_name(server)
42
42
  if @node_list.include?(server_name)
43
- node = @node_list[server_name]
43
+ node = @node_list[server_name]
44
44
  # Raise serverlisting error on invalid chef_node_attribute.
45
45
  if col_info[:key] == config[:chef_node_attribute] && ! node.attribute?(col_info[:key])
46
46
  error_message = "The Node does not have a #{col_info[:key]} attribute."
@@ -66,16 +66,16 @@ class Chef
66
66
  end
67
67
 
68
68
  def format_server_state(state)
69
- state = state.to_s.downcase
70
- state_color = case state
71
- when 'shutting-down','terminated','stopping','stopped','error','shutoff'
72
- :red
73
- when 'pending','build','paused','suspended','hard_reboot'
74
- :yellow
75
- else
76
- :green
77
- end
78
- ui.color(state, state_color)
69
+ state = state.to_s.downcase
70
+ state_color = case state
71
+ when "shutting-down", "terminated", "stopping", "stopped", "error", "shutoff"
72
+ :red
73
+ when "pending", "build", "paused", "suspended", "hard_reboot"
74
+ :yellow
75
+ else
76
+ :green
77
+ end
78
+ ui.color(state, state_color)
79
79
  end
80
80
 
81
81
  end # class ServerListCommand