stackmate 0.0.3 → 0.0.4

Sign up to get free protection for your applications and to get access to all the features.
@@ -2,3 +2,4 @@ require 'stackmate/stack'
2
2
  require 'stackmate/stack_executor'
3
3
  require 'stackmate/participants/common.rb'
4
4
  require 'stackmate/participants/cloudstack.rb'
5
+ require 'stackmate/aws_attribs.rb'
@@ -1,4 +1,4 @@
1
- AWS_ATTRIBS = {'AWS::CloudFormation::WaitCondition' => [ 'Data'],
1
+ AWS_ATTRIBS = {'AWS::CloudFormation::WaitCondition' => [ 'Data'],
2
2
  'AWS::CloudFormation::Stack' => ['Outputs.EmbeddedStackOutputName'],
3
3
  'AWS::CloudFront::Distribution' => ['DomainName'],
4
4
  'AWS::EC2::EIP' => ['AllocationId'],
@@ -15,3 +15,19 @@
15
15
  'AWS::SQS::Queue' => ['Arn', 'QueueName']
16
16
  }
17
17
 
18
+
19
+ AWS_FAKE_ATTRIB_VALUES = {'AWS::CloudFormation::WaitCondition' => {'Data' => '{ "Signal1" : "Step 1 complete." , "Signal2" : "Step 2 complete." } '},
20
+ 'AWS::CloudFormation::Stack' => {'Outputs.EmbeddedStackOutputName' => 'FakeEmbeddedStackOutputName'},
21
+ 'AWS::CloudFront::Distribution' => {'DomainName' => 'd2fadu0nynjpfn.cloudfront.net'},
22
+ 'AWS::EC2::EIP' => {'AllocationId' => 'eipalloc-5723d13e'},
23
+ 'AWS::EC2::Instance' => {'AvailabilityZone' => 'us-east-1b', 'PrivateDnsName' => 'ip-10-24-34-0.cs.internal', 'PublicDnsName' => 'cs-17-10-90-145.compute.acs.org.', 'PrivateIp' => '10.24.34.0', 'PublicIp' => '75.75.75.111'},
24
+ 'AWS::EC2::AWS::EC2::SubnetNetworkAclAssociation' => {'AssociationId' => 'aclassoc-e5b95c8c'},
25
+ 'AWS::ElasticBeanstalk::Environment' => {'EndpointURL' => 'eb-myst-myen-132MQC4KRLAMD-1371280482.us-east-1.elb.amazonaws.com'},
26
+ 'AWS::ElasticLoadBalancing::LoadBalancer' => {'CanonicalHostedZoneName' => 'mystack-myelb-15HMABG9ZCN57-1013119603.us-east-1.elb.amazonaws.com', 'CanonicalHostedZoneNameID' => 'Z3DZXE0Q79N41H', 'DNSName' => 'mystack-myelb-15HMABG9ZCN57-1013119603.us-east-1.elb.amazonaws.com', 'SourceSecurityGroup.GroupName' => 'elb-ssg', 'SourceSecurityGroup.OwnerAlias' => 'elb-ssg-owner'},
27
+ 'AWS::IAM::AccessKey' => {'SecretAccessKey' => 'c8alrXUtnYEMI/K7MDAZQ/bPxRfiCYzEXAMPLEKEY'},
28
+ 'AWS::IAM::Group' => {'Arn' => 'arn:aws:iam::123456789012:group/mystack-mygroup-1DZETITOWEKVO'},
29
+ 'AWS::IAM::User' => {'Arn' => 'mystack-myuser-1CCXAFG2H2U4D'},
30
+ 'AWS::RDS::DBInstance' => {'Endpoint.Address' => 'mystack-mydb-1apw1j4phylrk.cg034hpkmmjt.us-east-1.rds.amazonaws.com', 'Endpoint.Port' => '3306'},
31
+ 'AWS::S3::Bucket' => {'DomainName' => 'mystack-mybucket-kdwwxmddtr2g.s3.amazonaws.com', 'WebsiteURL' => 'http://mystack-mybucket-kdwwxmddtr2g.s3-website-us-east-1.amazonaws.com/', 'Arn' => 'arn:aws:s3::12345678901::root'},
32
+ 'AWS::SQS::Queue' => {'Arn' => 'arn:aws:sqs:us-east-1:123456789012:mystack-myqueue-15PG5C2FC1CW8', 'QueueName' => 'mystack-myqueue-1VF9BKQH5BJVI'}
33
+ }
@@ -1,4 +1,6 @@
1
1
  require 'stackmate/logging'
2
+ require 'stackmate/aws_attribs'
3
+ require 'stackmate/intrinsic_functions'
2
4
 
3
5
  module StackMate
4
6
 
@@ -48,10 +50,21 @@ end
48
50
 
49
51
  class Output < Ruote::Participant
50
52
  include Logging
53
+ include Intrinsic
54
+
51
55
  def on_workitem
52
56
  #p workitem.fields.keys
53
57
  logger.debug "Entering #{workitem.participant_name} "
54
- logger.debug "Done"
58
+ outputs = workitem.fields['Outputs']
59
+ logger.debug "In StackMate::Output.on_workitem #{outputs.inspect}"
60
+ outputs.each do |key, val|
61
+ v = val['Value']
62
+ constructed_value = intrinsic(v, workitem)
63
+ val['Value'] = constructed_value
64
+ logger.debug "Output: key = #{key}, value = #{constructed_value} descr = #{val['Description']}"
65
+ end
66
+
67
+ logger.debug "Output Done"
55
68
  reply
56
69
  end
57
70
  end
@@ -65,6 +78,12 @@ class NoOpResource < Ruote::Participant
65
78
  stackname = workitem.fields['ResolvedNames']['AWS::StackName']
66
79
  logger.debug "physical id is #{stackname}-#{participant_name} "
67
80
  workitem[participant_name][:physical_id] = stackname + '-' + participant_name
81
+ typ = workitem['Resources'][participant_name]['Type']
82
+ if AWS_FAKE_ATTRIB_VALUES[typ]
83
+ AWS_FAKE_ATTRIB_VALUES[typ].each do |k,v|
84
+ workitem[participant_name][k] = v
85
+ end
86
+ end
68
87
  reply
69
88
  end
70
89
  end
@@ -1,3 +1,3 @@
1
1
  module StackMate
2
- VERSION = "0.0.3"
2
+ VERSION = "0.0.4"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: stackmate
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.0.4
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-06-05 00:00:00.000000000 Z
12
+ date: 2013-06-10 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: cloudstack_ruby_client