zaws 0.0.4 → 0.0.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/Gemfile.lock +1 -1
- data/README.md +3 -0
- data/feature/elasticip/elasticip.feature +7 -7
- data/feature/security_group/security_group.feature +1 -1
- data/feature/version.feature +1 -1
- data/lib/zaws/ec2/elasticip.rb +3 -9
- data/lib/zaws/ec2/security_group.rb +1 -1
- data/lib/zaws/helper/shell.rb +1 -1
- data/lib/zaws/version.rb +1 -1
- metadata +4 -4
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -1,4 +1,7 @@
|
|
1
1
|
[](https://travis-ci.org/zynxhealth/zaws) [](https://coveralls.io/r/zynxhealth/zaws?branch=master) [](http://badge.fury.io/rb/zaws)
|
2
|
+
|
3
|
+
* For some reason the Coverage is flip floppping between 99% and mid 80%s, this looks like an issue with picking up some results. The 99% value is more accurate.
|
4
|
+
|
2
5
|
# zaws
|
3
6
|
|
4
7
|
Zynx AWS Automation Tool
|
@@ -37,11 +37,11 @@ Feature: Elasticip
|
|
37
37
|
"""
|
38
38
|
{ "PublicIp": "198.51.100.0", "Domain": "vpc", "AllocationId": "eipalloc-abcd1234", "AllocationId":"eipalloc-abcd1234" }
|
39
39
|
"""
|
40
|
-
And I double `aws --region us-west-1 ec2 associate-address --instance-id i-abc1234 --
|
40
|
+
And I double `aws --region us-west-1 ec2 associate-address --instance-id i-abc1234 --allocation-id eipalloc-abcd1234` with stdout:
|
41
41
|
"""
|
42
42
|
{ "return": "true" }
|
43
43
|
"""
|
44
|
-
When I run `bundle exec zaws elasticip declare my_instance --region us-west-1 --vpcid my_vpc_id`
|
44
|
+
When I run `bundle exec zaws elasticip declare my_instance --region us-west-1 --vpcid my_vpc_id --verbose`
|
45
45
|
Then the output should contain "New elastic ip associated to instance.\n"
|
46
46
|
|
47
47
|
Scenario: Declare elasticip for an instance by external id, Skip creation
|
@@ -65,15 +65,15 @@ Feature: Elasticip
|
|
65
65
|
"""
|
66
66
|
{ "Addresses": [ { "InstanceId" : "i-abc1234", "PublicIp": "198.51.100.0", "Domain": "vpc", "AssociationId":"eipassoc-abcd1234", "AllocationId":"eipalloc-abcd1234"} ] }
|
67
67
|
"""
|
68
|
-
And I double `aws --region us-west-1 ec2 disassociate-address --
|
68
|
+
And I double `aws --region us-west-1 ec2 disassociate-address --association-id eipassoc-abcd1234` with stdout:
|
69
69
|
"""
|
70
70
|
{ "return": "true" }
|
71
71
|
"""
|
72
|
-
And I double `aws --region us-west-1 ec2 release-address --
|
72
|
+
And I double `aws --region us-west-1 ec2 release-address --allocation-id eipalloc-abcd1234` with stdout:
|
73
73
|
"""
|
74
74
|
{ "return": "true" }
|
75
75
|
"""
|
76
|
-
When I run `bundle exec zaws elasticip release my_instance --region us-west-1 --vpcid my_vpc_id`
|
76
|
+
When I run `bundle exec zaws elasticip release my_instance --region us-west-1 --vpcid my_vpc_id --verbose`
|
77
77
|
Then the output should contain "Deleted elasticip.\n"
|
78
78
|
|
79
79
|
Scenario: Delete, skip
|
@@ -125,12 +125,12 @@ Feature: Elasticip
|
|
125
125
|
"""
|
126
126
|
{ "PublicIp": "198.51.100.0", "Domain": "vpc", "AllocationId": "eipalloc-abcd1234", "AllocationId":"eipalloc-abcd1234" }
|
127
127
|
"""
|
128
|
-
And I double `aws --region us-west-1 ec2 associate-address --instance-id i-abc1234 --
|
128
|
+
And I double `aws --region us-west-1 ec2 associate-address --instance-id i-abc1234 --allocation-id eipalloc-abcd1234` with stdout:
|
129
129
|
"""
|
130
130
|
{ "return": "true" }
|
131
131
|
"""
|
132
132
|
Given an empty file named "undo.sh.1"
|
133
|
-
When I run `bundle exec zaws elasticip declare my_instance --region us-west-1 --vpcid my_vpc_id --undofile undo.sh.1`
|
133
|
+
When I run `bundle exec zaws elasticip declare my_instance --region us-west-1 --vpcid my_vpc_id --undofile undo.sh.1 --verbose`
|
134
134
|
Then the output should contain "New elastic ip associated to instance.\n"
|
135
135
|
And the file "undo.sh.1" should contain "zaws elasticip release my_instance --region us-west-1 --vpcid my_vpc_id $XTRA_OPTS"
|
136
136
|
|
@@ -46,7 +46,7 @@ Feature: Security Group
|
|
46
46
|
"""
|
47
47
|
{ "SecurityGroups": [ { "GroupName": "my_security_group_name","GroupId": "sg-abcd1234" } ] }
|
48
48
|
"""
|
49
|
-
And I double `aws --region us-west-1 ec2 delete-security-group --group-
|
49
|
+
And I double `aws --region us-west-1 ec2 delete-security-group --group-id sg-abcd1234` with stdout:
|
50
50
|
"""
|
51
51
|
{ "return": "true" }
|
52
52
|
"""
|
data/feature/version.feature
CHANGED
data/lib/zaws/ec2/elasticip.rb
CHANGED
@@ -27,14 +27,10 @@ module ZAWS
|
|
27
27
|
val,instance_id,sgroups=@aws.ec2.compute.exists(region,nil,verbose,vpcid,externalid)
|
28
28
|
if val
|
29
29
|
addresses=JSON.parse(view(region,'json',nil,verbose,vpcid,instance_id))
|
30
|
-
verbose.puts addresses if verbose
|
31
30
|
addressassoc=(addresses["Addresses"] and (addresses["Addresses"].count == 1))
|
32
31
|
associationid= (addressassoc and addresses["Addresses"][0]["AssociationId"]) ? addresses["Addresses"][0]["AssociationId"]:nil
|
33
32
|
allocationid= (addressassoc and addresses["Addresses"][0]["AllocationId"]) ? addresses["Addresses"][0]["AllocationId"]:nil
|
34
33
|
ip= (addressassoc and addresses["Addresses"][0]["PublicIp"]) ? addresses["Addresses"][0]["PublicIp"]:nil
|
35
|
-
verbose.puts "addressassoc=#{addressassoc}" if verbose
|
36
|
-
verbose.puts "associationid=#{associationid}" if verbose
|
37
|
-
verbose.puts "allocationid=#{allocationid}" if verbose
|
38
34
|
textout.puts addressassoc if textout
|
39
35
|
return addressassoc,instance_id,associationid,allocationid,ip
|
40
36
|
else
|
@@ -53,7 +49,7 @@ module ZAWS
|
|
53
49
|
comline="aws --region #{region} ec2 allocate-address --domain vpc"
|
54
50
|
allocation=JSON.parse(@shellout.cli(comline,verbose))
|
55
51
|
if allocation["AllocationId"]
|
56
|
-
comline="aws --region #{region} ec2 associate-address --instance-id #{instance_id} --
|
52
|
+
comline="aws --region #{region} ec2 associate-address --instance-id #{instance_id} --allocation-id #{allocation["AllocationId"]}"
|
57
53
|
association=JSON.parse(@shellout.cli(comline,verbose))
|
58
54
|
textout.puts "New elastic ip associated to instance." if association["return"] == "true"
|
59
55
|
end
|
@@ -65,12 +61,10 @@ module ZAWS
|
|
65
61
|
def release(region,externalid,textout=nil,verbose=nil,vpcid=nil)
|
66
62
|
elasticip_exists,instance_id,association_id,allocation_id,ip=assoc_exists(region,externalid,nil,verbose,vpcid)
|
67
63
|
if elasticip_exists and association_id and allocation_id
|
68
|
-
|
69
|
-
comline="aws --region #{region} ec2 disassociate-address --public-ip #{ip} --association-id #{association_id}"
|
70
|
-
verbose.puts comline if verbose
|
64
|
+
comline="aws --region #{region} ec2 disassociate-address --association-id #{association_id}"
|
71
65
|
disassociation=JSON.parse(@shellout.cli(comline,verbose))
|
72
66
|
if disassociation["return"]=="true"
|
73
|
-
comline="aws --region #{region} ec2 release-address --
|
67
|
+
comline="aws --region #{region} ec2 release-address --allocation-id #{allocation_id}"
|
74
68
|
release=JSON.parse(@shellout.cli(comline,verbose))
|
75
69
|
textout.puts "Deleted elasticip." if release["return"] == "true"
|
76
70
|
end
|
@@ -64,7 +64,7 @@ module ZAWS
|
|
64
64
|
def delete(region,textout=nil,verbose=nil,vpcid,groupname)
|
65
65
|
groupid=id_by_name(region,nil,nil,vpcid,groupname)
|
66
66
|
if groupid
|
67
|
-
comline="aws --region #{region} ec2 delete-security-group --group-
|
67
|
+
comline="aws --region #{region} ec2 delete-security-group --group-id #{groupid}"
|
68
68
|
sgroup=JSON.parse(@shellout.cli(comline,verbose))
|
69
69
|
textout.puts "Security Group deleted." if sgroup["return"] == "true"
|
70
70
|
else
|
data/lib/zaws/helper/shell.rb
CHANGED
@@ -6,7 +6,7 @@ module ZAWS
|
|
6
6
|
|
7
7
|
def cli(command,output=nil)
|
8
8
|
output.puts ZAWS::Helper::Output.colorize(command,AWS_consts::COLOR_BLUE) if output
|
9
|
-
list = Mixlib::ShellOut.new(command)
|
9
|
+
list = Mixlib::ShellOut.new(command, :timeout => 30)
|
10
10
|
list.run_command
|
11
11
|
list.error!
|
12
12
|
return list.stdout
|
data/lib/zaws/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: zaws
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.5
|
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: 2014-06-
|
12
|
+
date: 2014-06-27 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: thor
|
@@ -303,7 +303,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
303
303
|
version: '0'
|
304
304
|
segments:
|
305
305
|
- 0
|
306
|
-
hash:
|
306
|
+
hash: 860318831124502265
|
307
307
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
308
308
|
none: false
|
309
309
|
requirements:
|
@@ -312,7 +312,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
312
312
|
version: '0'
|
313
313
|
segments:
|
314
314
|
- 0
|
315
|
-
hash:
|
315
|
+
hash: 860318831124502265
|
316
316
|
requirements: []
|
317
317
|
rubyforge_project:
|
318
318
|
rubygems_version: 1.8.24
|