lib/kumogata/client.rb in kumogata-0.2.18 vs lib/kumogata/client.rb in kumogata-0.2.19

- old
+ new

@@ -200,12 +200,21 @@ end EOS end def create_stack(template, stack_name) - stack_name = stack_name || 'kumogata-' + UUIDTools::UUID.timestamp_create + unless stack_name + user_host = Kumogata::Utils.get_user_host + stack_name = ['kumogata'] + stack_name << user_host if user_host + stack_name << UUIDTools::UUID.timestamp_create + + stack_name = stack_name.join('-') + stack_name.gsub!(/[^-a-zA-Z0-9]+/, '-') + end + Kumogata.logger.info("Creating stack: #{stack_name}".cyan) stack = @cloud_formation.stacks.create(stack_name, template.to_json, build_create_options) unless while_in_progress(stack, 'CREATE_COMPLETE') errmsgs = ['Create failed'] @@ -406,11 +415,11 @@ :resource_type, :stack_id, :stack_name, :timestamp, ].each do |k| - event_hash[camelize(k)] = event.send(k) + event_hash[Kumogata::Utils.camelize(k)] = event.send(k) end event_hash end end @@ -435,11 +444,11 @@ :resource_type, :resource_status, :resource_status_reason, :last_updated_timestamp ].each do |k| - summary_hash[camelize(k)] = summary[k] + summary_hash[Kumogata::Utils.camelize(k)] = summary[k] end summary_hash end end @@ -461,15 +470,9 @@ 'StackName' => stack_name, 'Outputs' => outputs, 'StackResourceSummaries' => summaries, }) end - end - - def camelize(str) - str.to_s.split(/[-_]/).map {|i| - i[0, 1].upcase + i[1..-1].downcase - }.join end def validate_stack_name(stack_name) return unless stack_name