Class: GreenAndSecure::BlockList
- Inherits:
-
Chef::Knife
- Object
- Chef::Knife
- GreenAndSecure::BlockList
- Defined in:
- lib/chef/knife/block.rb
Instance Method Summary collapse
- #current_server ⇒ Object
-
#run ⇒ Object
list the available environments.
- #servers ⇒ Object
Methods inherited from Chef::Knife
Instance Method Details
#current_server ⇒ Object
120 121 122 123 124 125 126 127 128 |
# File 'lib/chef/knife/block.rb', line 120 def current_server GreenAndSecure::check_block_setup @current_server ||= if File.exists?(GreenAndSecure::chef_config_base+"/knife.rb") then GreenAndSecure::printable_server(File.readlink(GreenAndSecure::chef_config_base+"/knife.rb")) else nil end end |
#run ⇒ Object
list the available environments
140 141 142 143 144 145 146 147 148 149 150 |
# File 'lib/chef/knife/block.rb', line 140 def run GreenAndSecure::check_block_setup puts "The available chef servers are:" servers.each do |server| if server == current_server then puts "\t* #{server} [ Currently Selected ]" else puts "\t* #{server}" end end end |
#servers ⇒ Object
132 133 134 135 136 137 |
# File 'lib/chef/knife/block.rb', line 132 def servers ## get the list of available environments by searching ~/.chef for knife.rb files @servers ||= Dir.glob(GreenAndSecure::chef_config_base+"/knife-*.rb").sort.map do |fn| GreenAndSecure::printable_server(fn) end end |