awful 0.0.136 → 0.0.137

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: afe9345863882bca15eb3e075919d190b50de773
4
- data.tar.gz: e9bafe169cbc400fd85676bcfd375281a155a2e0
3
+ metadata.gz: fd7f5a4afe16eabf9cd341d1bf623c9b12fb4bdb
4
+ data.tar.gz: 2672c70ade9bf706223b7e5e94dd7cce36a18de4
5
5
  SHA512:
6
- metadata.gz: 327e6d510c2adc410dc2fbf93d4700bc9d1e2d589ebf333fa2857d8a76bd926098a18c85fe8ece14c0efb6eae9e43f322bbe05654d05b0cd6399482f73c32341
7
- data.tar.gz: f6915c25c9f5084c6cb77eed91de95266055d58461ab5782a6e6e523e912769488224388479a1f94e4ec7b31c0ef38fbaec52841c4e2a4768769b2a0aaa9152f
6
+ metadata.gz: c217f3fd28a0f5ab734310df7590f3ec368c04f1a6052c8dfe105ec0be8294d543fae422d59a3497f439cdac33cb858ab4e9390b082587f6365221dfac2238eb
7
+ data.tar.gz: e6b433c9564d9b143be1ca2e97dbefad9fbe468bf5c079ffb522a51799f51594489e9c9520d0592d8d22f1c1559019dfff4c7b6b0f9d4441843b81d071043334
data/lib/awful/elb.rb CHANGED
@@ -151,7 +151,7 @@ module Awful
151
151
  def state(name, *instances)
152
152
  elb.describe_instance_health(load_balancer_name: name, instances: instance_ids(*instances)).instance_states.output do |list|
153
153
  if options[:long]
154
- print_table list.map { |i| [ i.instance_id, i.state, i.reason_code, i.description ] }
154
+ print_table list.map { |i| [ i.instance_id, color(i.state), i.reason_code, i.description ] }
155
155
  else
156
156
  puts list.map(&:state)
157
157
  end
data/lib/awful/route53.rb CHANGED
@@ -49,7 +49,7 @@ module Awful
49
49
  def ls(name = /./)
50
50
  route53.list_hosted_zones.hosted_zones.select do |zone|
51
51
  zone.name.match(name)
52
- end.tap do |list|
52
+ end.output do |list|
53
53
  if options[:long]
54
54
  print_table list.map { |z| [z.name, z.id, z.resource_record_set_count, z.config.comment] }
55
55
  else
@@ -76,7 +76,7 @@ module Awful
76
76
  max_items: options[:max_items]
77
77
  ).resource_record_sets.select do |rrset|
78
78
  include_type.call(rrset.type) and include_name.call(rrset.name)
79
- end.tap do |records|
79
+ end.output do |records|
80
80
  if options[:long]
81
81
  print_table records.map { |r|
82
82
  dns_name = r.alias_target.nil? ? [] : ['ALIAS ' + r.alias_target.dns_name]
@@ -100,7 +100,7 @@ module Awful
100
100
  start_record_type: options[:type],
101
101
  max_items: options[:max_items]
102
102
  }
103
- route53.list_resource_record_sets(params).resource_record_sets.tap do |records|
103
+ route53.list_resource_record_sets(params).resource_record_sets.output do |records|
104
104
  records.each do |record|
105
105
  puts YAML.dump(stringify_keys(record.to_hash))
106
106
  end
@@ -115,19 +115,25 @@ module Awful
115
115
 
116
116
  ## create/update alias to ELB record; later add S3, CF, Beanstalk, rrsets
117
117
  desc 'alias NAME', 'upsert an alias to an AWS resource given by name'
118
- method_option :resource, aliases: '-r', type: :string, default: 'elb', desc: 'Type of target resource, for now just `elb`'
119
- method_option :type, aliases: '-t', type: :string, default: 'A', desc: 'Type of record: A, SOA, TXT, NS, CNAME, MX, PTR, SRV, SPF, AAAA'
118
+ method_option :resource, aliases: '-r', type: :string, default: 'elb', desc: 'Type of target resource, for now just `elb`'
119
+ method_option :type, aliases: '-t', type: :string, default: 'A', desc: 'Type of record: A, SOA, TXT, NS, CNAME, MX, PTR, SRV, SPF, AAAA'
120
+ method_option :weight, aliases: '-w', type: :numeric, default: nil, desc: 'weight of record (requires set_identifier)'
121
+ method_option :set_identifier, aliases: '-s', type: :string, default: nil, desc: 'weighted record set unique identifier (requires weight)'
122
+ method_option :delete, type: :boolean, default: false, desc: 'delete record'
120
123
  def alias(name, target)
121
124
  dns_name, hosted_zone_id = send("get_#{options[:resource]}_dns", target)
125
+ action = options[:delete] ? 'DELETE' : 'UPSERT'
122
126
  params = {
123
127
  hosted_zone_id: get_zone_by_name(get_domain(name)),
124
128
  change_batch: {
125
129
  changes: [
126
130
  {
127
- action: 'UPSERT',
131
+ action: action,
128
132
  resource_record_set: {
129
- name: name,
130
- type: options[:type],
133
+ name: name,
134
+ type: options[:type],
135
+ set_identifier: options[:set_identifier],
136
+ weight: options[:weight],
131
137
  alias_target: {
132
138
  hosted_zone_id: hosted_zone_id,
133
139
  dns_name: dns_name,
@@ -138,7 +144,7 @@ module Awful
138
144
  ]
139
145
  }
140
146
  }
141
- route53.change_resource_record_sets(params).tap do |response|
147
+ route53.change_resource_record_sets(params).output do |response|
142
148
  puts YAML.dump(stringify_keys(response.change_info.to_hash))
143
149
  end
144
150
  end
@@ -166,14 +172,14 @@ module Awful
166
172
  ]
167
173
  }
168
174
  }
169
- route53.change_resource_record_sets(params).tap do |response|
175
+ route53.change_resource_record_sets(params).output do |response|
170
176
  puts YAML.dump(stringify_keys(response.change_info.to_hash))
171
177
  end
172
178
  end
173
179
 
174
180
  desc 'change ID', 'get change batch request'
175
181
  def change(id)
176
- route53.get_change(id: id).change_info.tap do |info|
182
+ route53.get_change(id: id).change_info.output do |info|
177
183
  puts YAML.dump(stringify_keys(info.to_hash))
178
184
  end
179
185
  end
data/lib/awful/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Awful
2
- VERSION = '0.0.136'
2
+ VERSION = '0.0.137'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: awful
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.136
4
+ version: 0.0.137
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ric Lister
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-08-18 00:00:00.000000000 Z
11
+ date: 2016-08-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler