Module: KnifeCloudformation::Knife::Base
- Included in:
- Chef::Knife::CloudformationCreate, Chef::Knife::CloudformationDescribe, Chef::Knife::CloudformationDestroy, Chef::Knife::CloudformationEvents, Chef::Knife::CloudformationExport, Chef::Knife::CloudformationImport, Chef::Knife::CloudformationInspect, Chef::Knife::CloudformationList, Chef::Knife::CloudformationPromote, Chef::Knife::CloudformationUpdate, Chef::Knife::CloudformationValidate
- Defined in:
- lib/knife-cloudformation/knife/base.rb
Overview
Base to build cloudformation related knife commands
Defined Under Namespace
Modules: ClassMethods, InstanceMethods
Class Method Summary collapse
Class Method Details
.included(klass) ⇒ Object
125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 |
# File 'lib/knife-cloudformation/knife/base.rb', line 125 def included(klass) klass.instance_eval do extend KnifeCloudformation::Knife::Base::ClassMethods include KnifeCloudformation::Knife::Base::InstanceMethods include KnifeCloudformation::Utils::JSON include KnifeCloudformation::Utils::AnimalStrings include KnifeCloudformation::Utils::Output deps do Chef::Knife.new.configure_chef require 'miasma' Chef::Config[:knife][:cloudformation] ||= Mash.new Chef::Config[:knife][:cloudformation][:credentials] ||= Mash.new Chef::Config[:knife][:cloudformation][:options] ||= Mash.new Chef::Config[:knife][:cloudformation][:ignore_parameters] = [] %w(poll interactive_parameters apply_nesting).each do |key| if(Chef::Config[:knife][:cloudformation][key].nil?) Chef::Config[:knife][:cloudformation][key] = true end end end option(:credentials, :short => '-S CREDENTIALS', :long => '--credentials CREDENTIALS', :description => 'Miasma API options. Comma delimited or used multiple times. (-S "aws_access_key_id=MYKEY")', :proc => lambda {|val| val.split(',').each do |pair| key, value = pair.split('=') Chef::Config[:knife][:cloudformation][:credentials][key] = value end } ) option(:ignore_parameter, :long => '--ignore-parameter PARAMETER_NAME', :description => 'Parameter to ignore during modifications (can be used multiple times)', :proc => lambda{|val| Chef::Config[:knife][:cloudformation][:ignore_parameters].push(val).uniq! } ) # Populate up the hashes so they are available for knife config # with issues of nils ['knife.cloudformation.credentials', 'knife.cloudformation.options'].each do |stack| stack.split('.').inject(Chef::Config) do |memo, item| memo[item.to_sym] = Mash.new unless memo[item.to_sym] memo[item.to_sym] end end end end |