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
Instance Method Details
#current_server ⇒ Object
46 47 48 49 50 51 52 53 54 |
# File 'lib/chef/knife/block.rb', line 46 def current_server GreenAndSecure::check_block_setup @current_server ||= if File.exists?(::Chef::Knife::chef_config_dir+"/knife.rb") then GreenAndSecure::printable_server(File.readlink(::Chef::Knife::chef_config_dir+"/knife.rb")) else nil end end |
#run ⇒ Object
list the available environments
65 66 67 68 69 70 71 72 73 74 |
# File 'lib/chef/knife/block.rb', line 65 def run 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
57 58 59 60 61 62 |
# File 'lib/chef/knife/block.rb', line 57 def servers ## get the list of available environments by searching ~/.chef for knife.rb files @servers ||= Dir.glob(::Chef::Knife::chef_config_dir+"/knife-*.rb").sort.map do | fn | GreenAndSecure::printable_server(fn) end end |