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
124 125 126 127 128 129 130 131 132 |
# File 'lib/chef/knife/block.rb', line 124 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
144 145 146 147 148 149 150 151 152 153 154 |
# File 'lib/chef/knife/block.rb', line 144 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
136 137 138 139 140 141 |
# File 'lib/chef/knife/block.rb', line 136 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 |