lono 7.4.10 → 7.5.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +15 -1
- data/README.md +2 -1
- data/lib/lono/cfn/base.rb +0 -1
- data/lib/lono/cli.rb +4 -1
- data/lib/lono/generate.rb +6 -2
- data/lib/lono/help/{sets/instances → set_instances}/delete.md +1 -1
- data/lib/lono/help/set_instances/deploy.md +31 -0
- data/lib/lono/help/{sets/instances → set_instances}/list.md +1 -1
- data/lib/lono/help/{sets/instances → set_instances}/status.md +1 -1
- data/lib/lono/help/{sets/instances → set_instances}/sync.md +4 -2
- data/lib/lono/inspector/graph.rb +1 -1
- data/lib/lono/{sets/instances → set_instances}/base.rb +1 -1
- data/lib/lono/set_instances/changeable.rb +53 -0
- data/lib/lono/set_instances/create.rb +7 -0
- data/lib/lono/{sets/instances → set_instances}/delete.rb +9 -31
- data/lib/lono/set_instances/deploy.rb +52 -0
- data/lib/lono/{sets/instances → set_instances}/list.rb +1 -1
- data/lib/lono/{sets/instances → set_instances}/opts.rb +9 -1
- data/lib/lono/{sets/instances → set_instances}/status.rb +1 -1
- data/lib/lono/{sets/instances → set_instances}/sync.rb +4 -3
- data/lib/lono/set_instances/update.rb +15 -0
- data/lib/lono/set_instances.rb +54 -0
- data/lib/lono/sets/create.rb +0 -3
- data/lib/lono/sets/delete.rb +5 -14
- data/lib/lono/sets/status/instances.rb +8 -5
- data/lib/lono/sets/status.rb +15 -3
- data/lib/lono/sets/summarize.rb +2 -0
- data/lib/lono/sets/update.rb +6 -13
- data/lib/lono/sets/waiter.rb +23 -0
- data/lib/lono/sets.rb +0 -4
- data/lib/lono/template/strategy/dsl/builder/helpers/stack_helper.rb +2 -1
- data/lib/lono/version.rb +1 -1
- data/lib/lono.rb +1 -0
- data/lono.gemspec +1 -0
- metadata +34 -14
- data/lib/lono/sets/instances.rb +0 -33
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9bb488fbda283f04107b4e461bf641727b5235d748a3a417bc6dced426fe67f1
|
4
|
+
data.tar.gz: 90530c32b44d161ac7a0b5bdd546a15bb37b04946ed8a4de6ce39f9b968ad4a6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: cf60e6101ecad062a69f04ec343e7cb7e73d5b07252cf9546fbe71f5bae3a39a13b2b09faaa5213b44f86309e9bf7907022c337ad4f14cb57af3afacc1be3658
|
7
|
+
data.tar.gz: a3ddbafb4524a7f885e680021cd5fb07e8dc228e28b7a1c13dac73ebc475233f57e1ec93c35eecbe4eb155182cf807947791d875ac055042fa43c12a856462cf
|
data/CHANGELOG.md
CHANGED
@@ -3,6 +3,20 @@
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
4
4
|
This project *tries* to adhere to [Semantic Versioning](http://semver.org/), even before v1.0.
|
5
5
|
|
6
|
+
## [7.5.2] - 2022-02-08
|
7
|
+
- [#74](https://github.com/boltops-tools/lono/pull/74) activesupport require fix
|
8
|
+
- fix activesupport require
|
9
|
+
|
10
|
+
## [7.5.1] - 2021-05-03
|
11
|
+
- remove registration check
|
12
|
+
- fix brew install graphviz message
|
13
|
+
|
14
|
+
## [7.5.0]
|
15
|
+
- #71 `set_instances deploy` command in favor of `set_instances sync`
|
16
|
+
|
17
|
+
## [7.4.11]
|
18
|
+
- fix lookup_output
|
19
|
+
|
6
20
|
## [7.4.10]
|
7
21
|
- #70 fix out-of-sync Gemfile.lock
|
8
22
|
|
@@ -100,7 +114,7 @@ This project *tries* to adhere to [Semantic Versioning](http://semver.org/), eve
|
|
100
114
|
- #36 lono v7
|
101
115
|
- Breaking: project `blueprints` moved to `app/blueprints`. Use `lono upgrade` to update.
|
102
116
|
- Introduce configsets concept.
|
103
|
-
- Introduce lono sets concept: `lono sets`, `lono sets deploy`, `lono
|
117
|
+
- Introduce lono sets concept: `lono sets`, `lono sets deploy`, `lono set_instances sync`
|
104
118
|
- Merge lono-pro into lono. Deprecate lono-pro gem.
|
105
119
|
- Add lono registration.
|
106
120
|
- Major refactoring:
|
data/README.md
CHANGED
@@ -5,11 +5,12 @@
|
|
5
5
|
# Lono
|
6
6
|
|
7
7
|
![CodeBuild](https://codebuild.us-west-2.amazonaws.com/badges?uuid=eyJlbmNyeXB0ZWREYXRhIjoiYTloZ3dBZkZTYnlTaU1ZZTMvenROM1dmY2lDZzE0MDRVZ2d6NXdqb2JmSXNrQ3pkVGpKRTJMMnhTNDlOYUNOUlZZUmR6TktGcXRWMVFoYzhrSXFZWVZNPSIsIml2UGFyYW1ldGVyU3BlYyI6IkkrSGlFcTBWUjMzbk5xVGYiLCJtYXRlcmlhbFNldFNlcmlhbCI6MX0%3D&branch=master)
|
8
|
-
[![CircleCI](https://circleci.com/gh/tongueroo/lono.svg?style=svg)](https://circleci.com/gh/tongueroo/lono)
|
9
8
|
[![Support](https://img.shields.io/badge/get-support-blue.svg)](https://boltops.com?utm_source=badge&utm_medium=badge&utm_campaign=lono)
|
10
9
|
|
11
10
|
[![BoltOps Badge](https://img.boltops.com/boltops/badges/boltops-badge.png)](https://www.boltops.com)
|
12
11
|
|
12
|
+
Please **watch/star** this repo to help grow and support the project.
|
13
|
+
|
13
14
|
Lono is a CloudFormation framework. It builds, manages, and deploys CloudFormation templates.
|
14
15
|
|
15
16
|
## Lono Features
|
data/lib/lono/cfn/base.rb
CHANGED
data/lib/lono/cli.rb
CHANGED
@@ -13,7 +13,6 @@ module Lono
|
|
13
13
|
long_desc Help.text(:blueprints)
|
14
14
|
def blueprints
|
15
15
|
Finder::Blueprint.list
|
16
|
-
Lono::Registration.check
|
17
16
|
end
|
18
17
|
|
19
18
|
desc "configsets [BLUEPRINT]", "Lists configsets"
|
@@ -162,6 +161,10 @@ module Lono
|
|
162
161
|
long_desc Help.text(:sets)
|
163
162
|
subcommand "sets", Sets
|
164
163
|
|
164
|
+
desc "set_instances SUBCOMMAND", "set_instances subcommands"
|
165
|
+
long_desc Help.text(:set_instances)
|
166
|
+
subcommand "set_instances", SetInstances
|
167
|
+
|
165
168
|
desc "template SUBCOMMAND", "template subcommands"
|
166
169
|
long_desc Help.text(:template)
|
167
170
|
subcommand "template", Template
|
data/lib/lono/generate.rb
CHANGED
@@ -5,17 +5,21 @@ module Lono
|
|
5
5
|
def all
|
6
6
|
return @@parameters if @@parameters
|
7
7
|
|
8
|
-
ensure_s3_bucket_exist unless
|
8
|
+
ensure_s3_bucket_exist unless generate_only?
|
9
9
|
pre_generate
|
10
10
|
generate_templates # generates with some placeholders for build_files IE: file://app/files/my.rb
|
11
11
|
post_generate
|
12
|
-
upload unless
|
12
|
+
upload unless generate_only?
|
13
13
|
|
14
14
|
@@parameters = param_generator.generate # Writes the json file in CamelCase keys format
|
15
15
|
check_for_errors
|
16
16
|
@@parameters
|
17
17
|
end
|
18
18
|
|
19
|
+
def generate_only?
|
20
|
+
ENV['LONO_GENERATE_ONLY'] || @options[:generate_only]
|
21
|
+
end
|
22
|
+
|
19
23
|
def pre_generate
|
20
24
|
build_scripts
|
21
25
|
end
|
@@ -1,6 +1,6 @@
|
|
1
1
|
## Example
|
2
2
|
|
3
|
-
$ lono
|
3
|
+
$ lono set_instances delete my-set --accounts 112233445566 --regions us-west-1 us-west-2
|
4
4
|
Are you sure you want to delete the my-set instances?
|
5
5
|
These stack instances will be deleted:
|
6
6
|
|
@@ -0,0 +1,31 @@
|
|
1
|
+
The deploy command delegates to the `lono set_instances create` or `lono set_instances update` commands. This spares you from having to manually figuring out which stack instances need to be created and updated.
|
2
|
+
|
3
|
+
## Example
|
4
|
+
|
5
|
+
$ lono set_instances deploy enable-aws-config --accounts 111111111111 222222222222 --regions us-west-2 us-east-2Running lono set_instances create on account: 111111111111 regions: us-west-2,us-east-2
|
6
|
+
Deploying enable-aws-config stack set
|
7
|
+
Stack Set Operation Status: RUNNING
|
8
|
+
Stack Instance statuses... (takes a while)
|
9
|
+
You can also check with StackSets console at the Operations Tab.
|
10
|
+
Here is also the cli command to check:
|
11
|
+
|
12
|
+
aws cloudformation describe-stack-set-operation --stack-set-name enable-aws-config --operation-id 44a50065-1b10-49f0-b6b9-853092a0cb09
|
13
|
+
|
14
|
+
2020-04-25 10:58:32PM Stack Instance: account 222222222222 region us-east-2 status CURRENT
|
15
|
+
2020-04-25 10:58:32PM Stack Instance: account 111111111111 region us-west-2 status OUTDATED reason User initiated operation
|
16
|
+
2020-04-25 10:58:32PM Stack Instance: account 222222222222 region us-west-2 status CURRENT
|
17
|
+
2020-04-25 10:58:32PM Stack Instance: account 111111111111 region us-east-2 status OUTDATED reason User initiated operation
|
18
|
+
Stack Set Operation Status: SUCCEEDED
|
19
|
+
Time took to complete stack set operation: 1m 23s
|
20
|
+
Stack Set Operation Summary:
|
21
|
+
account 111111111111 region us-west-2 status SUCCEEDED
|
22
|
+
account 111111111111 region us-east-2 status SUCCEEDED
|
23
|
+
Running lono set_instances update on account: 222222222222 regions: us-west-2,us-east-2
|
24
|
+
Deploying enable-aws-config stack set
|
25
|
+
Stack Set Operation Status: RUNNING
|
26
|
+
Stack Set Operation Status: SUCCEEDED
|
27
|
+
Time took to complete stack set operation: 23s
|
28
|
+
Stack Set Operation Summary:
|
29
|
+
account 222222222222 region us-west-2 status SUCCEEDED
|
30
|
+
account 222222222222 region us-east-2 status SUCCEEDED
|
31
|
+
$
|
@@ -1,6 +1,6 @@
|
|
1
1
|
## Example
|
2
2
|
|
3
|
-
$ lono
|
3
|
+
$ lono set_instances list my-set
|
4
4
|
Stack Instance: account 112233445566 region ap-northeast-1 status CURRENT
|
5
5
|
Stack Instance: account 223344556677 region us-west-1 status CURRENT
|
6
6
|
Stack Instance: account 223344556677 region ap-northeast-1 status CURRENT
|
@@ -1,6 +1,6 @@
|
|
1
1
|
## Example
|
2
2
|
|
3
|
-
$ lono
|
3
|
+
$ lono set_instances status my-set
|
4
4
|
Stack Instance statuses... (takes a while)
|
5
5
|
Stack Instance: account 112233445566 region ap-northeast-1 status CURRENT
|
6
6
|
Stack Instance: account 112233445566 region us-west-1 status CURRENT
|
@@ -1,3 +1,5 @@
|
|
1
|
+
IMPORTANT: The `lono set_instances sync` command is deprecated in favor of `lono set_instances deploy`. With stack sets, found more success with explicitness.
|
2
|
+
|
1
3
|
Lono uses the `config/accounts` and `config/regions` to calculate whether `create-stack-set` or `delete-stack-set` need to be called and calls them accordingly. You use this instead of `lono sets deploy` when only configs have been adjust and you want to keep the existing template.
|
2
4
|
|
3
5
|
Provided:
|
@@ -23,9 +25,9 @@ configs/demo/regions/development/my-set.txt
|
|
23
25
|
ap-northeast-1
|
24
26
|
ap-northeast-2
|
25
27
|
|
26
|
-
Running `lono
|
28
|
+
Running `lono set_instances sync` will delete and add the stack instances accordingly.
|
27
29
|
|
28
|
-
$ lono
|
30
|
+
$ lono set_instances sync my-set --blueprint demo
|
29
31
|
Using regions for development: configs/demo/regions/development/my-set.sh
|
30
32
|
Using accounts for development: configs/demo/accounts/development/my-set.sh
|
31
33
|
Are you sure you want to sync stack instances?
|
data/lib/lono/inspector/graph.rb
CHANGED
@@ -102,7 +102,7 @@ module Lono::Inspector
|
|
102
102
|
puts "It appears that the Graphviz is not installed. Please install it to generate the graph."
|
103
103
|
if RUBY_PLATFORM =~ /darwin/
|
104
104
|
puts "You can install Graphviz with homebrew:"
|
105
|
-
puts "
|
105
|
+
puts " brew install graphviz"
|
106
106
|
end
|
107
107
|
exit 1
|
108
108
|
end
|
@@ -0,0 +1,53 @@
|
|
1
|
+
class Lono::SetInstances
|
2
|
+
class Changeable < Base
|
3
|
+
include Lono::AwsServices
|
4
|
+
include Lono::Utils::Sure
|
5
|
+
|
6
|
+
def initialize(options={})
|
7
|
+
super # need conventions so config lookup will work
|
8
|
+
@regions, @accounts = [], []
|
9
|
+
end
|
10
|
+
|
11
|
+
def run
|
12
|
+
validate!
|
13
|
+
|
14
|
+
unless stack_set_exists?(@stack)
|
15
|
+
puts "ERROR: Cannot update a stack set because #{@stack} does not exists.".color(:red)
|
16
|
+
return
|
17
|
+
end
|
18
|
+
exit_unless_updatable!
|
19
|
+
|
20
|
+
options = {
|
21
|
+
stack_set_name: @stack,
|
22
|
+
accounts: accounts,
|
23
|
+
regions: regions,
|
24
|
+
}
|
25
|
+
begin
|
26
|
+
resp = perform(options)
|
27
|
+
rescue Aws::CloudFormation::Errors::ValidationError => e
|
28
|
+
# IE: Aws::CloudFormation::Errors::ValidationError: Region eu-north-1 is not supported
|
29
|
+
puts "#{e.class}: #{e.message}".color(:red)
|
30
|
+
exit 1
|
31
|
+
end
|
32
|
+
|
33
|
+
return true if @options[:noop]
|
34
|
+
Lono::Sets::Waiter.new(@options).run(resp[:operation_id])
|
35
|
+
end
|
36
|
+
|
37
|
+
def validate!
|
38
|
+
invalid = (regions.blank? || accounts.blank?) && !@options[:all]
|
39
|
+
if invalid
|
40
|
+
puts "ERROR: You must provide --accounts and --regions or --all.".color(:red)
|
41
|
+
exit 1
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
45
|
+
def accounts
|
46
|
+
@options[:all] ? stack_instances.map(&:account).uniq : @options[:accounts]
|
47
|
+
end
|
48
|
+
|
49
|
+
def regions
|
50
|
+
@options[:all] ? stack_instances.map(&:region).uniq : @options[:regions]
|
51
|
+
end
|
52
|
+
end
|
53
|
+
end
|
@@ -1,28 +1,24 @@
|
|
1
|
-
class Lono::
|
2
|
-
class Delete <
|
3
|
-
include Lono::AwsServices
|
4
|
-
include Lono::Utils::Sure
|
5
|
-
|
1
|
+
class Lono::SetInstances
|
2
|
+
class Delete < Changeable
|
6
3
|
def initialize(options={})
|
7
|
-
|
4
|
+
super
|
8
5
|
@stack = options[:stack]
|
9
6
|
end
|
10
7
|
|
11
8
|
def run
|
12
9
|
validate!
|
13
10
|
|
14
|
-
sure?("Are you sure you want to delete the #{@stack} instances?", long_desc)
|
11
|
+
sure?("Are you sure you want to delete the #{@stack} stack instances?", long_desc)
|
15
12
|
|
16
13
|
# delete_stack_instances resp has operation_id
|
17
14
|
# Could also use that to poll for status with the list_stack_set_operation_results
|
18
15
|
# api. Currently, Instance::Status class not using this info. If we need will add the logic.
|
16
|
+
retain_stacks = @options[:retain_stacks] ? @options[:retain_stacks] : false
|
19
17
|
resp = cfn.delete_stack_instances(
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
retain_stacks: false,
|
25
|
-
}
|
18
|
+
stack_set_name: @stack,
|
19
|
+
accounts: accounts,
|
20
|
+
regions: regions,
|
21
|
+
retain_stacks: retain_stacks,
|
26
22
|
)
|
27
23
|
operation_id = resp.operation_id
|
28
24
|
|
@@ -32,8 +28,6 @@ class Lono::Sets::Instances
|
|
32
28
|
start_on_outdated: false,
|
33
29
|
operation_id: operation_id,
|
34
30
|
)
|
35
|
-
Lono::Sets::Status::Instance::Base.show_time_progress = true
|
36
|
-
Lono::Sets::Status::Instance::Base.delay_factor = accounts.size * regions.size
|
37
31
|
instances_status = Status.new(o)
|
38
32
|
instances_status.run(to: "deleted") unless @options[:noop] # returns success: true or false
|
39
33
|
end
|
@@ -49,21 +43,5 @@ class Lono::Sets::Instances
|
|
49
43
|
Number of stack instances to be deleted: #{total}
|
50
44
|
EOL
|
51
45
|
end
|
52
|
-
|
53
|
-
def validate!
|
54
|
-
invalid = (regions.blank? || accounts.blank?) && !@options[:all]
|
55
|
-
if invalid
|
56
|
-
puts "ERROR: You must provide --accounts and --regions or --all.".color(:red)
|
57
|
-
exit 1
|
58
|
-
end
|
59
|
-
end
|
60
|
-
|
61
|
-
def accounts
|
62
|
-
@options[:all] ? stack_instances.map(&:account).uniq : @options[:accounts]
|
63
|
-
end
|
64
|
-
|
65
|
-
def regions
|
66
|
-
@options[:all] ? stack_instances.map(&:region).uniq : @options[:regions]
|
67
|
-
end
|
68
46
|
end
|
69
47
|
end
|
@@ -0,0 +1,52 @@
|
|
1
|
+
class Lono::SetInstances
|
2
|
+
class Deploy < Changeable
|
3
|
+
def run
|
4
|
+
# computes whether create or update should be ran for stack instances within each account
|
5
|
+
updates, creates = Hash.new([]), Hash.new([])
|
6
|
+
accounts.each do |account|
|
7
|
+
regions.each do |region|
|
8
|
+
if stack_instance_exists?(account, region)
|
9
|
+
updates[account] += [region] # += [item] works, << item doesnt seem to work
|
10
|
+
else
|
11
|
+
creates[account] += [region] # += [item] works, << item doesnt seem to work
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
deploy(:create, creates)
|
17
|
+
deploy(:update, updates)
|
18
|
+
end
|
19
|
+
|
20
|
+
def deploy(type, changes)
|
21
|
+
changes.each do |account, regions|
|
22
|
+
run_action(type, account, regions)
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
def run_action(type, account, regions)
|
27
|
+
klass = "Lono::SetInstances::#{type.to_s.camelize}"
|
28
|
+
klass = klass.constantize
|
29
|
+
command = lono_command(klass)
|
30
|
+
puts "Running #{command.color(:green)} on account: #{account} regions: #{regions.join(',')}"
|
31
|
+
|
32
|
+
options = @options.dup
|
33
|
+
options[:accounts] = [account]
|
34
|
+
options[:regions] = regions
|
35
|
+
klass.new(options).run
|
36
|
+
end
|
37
|
+
|
38
|
+
def lono_command(klass)
|
39
|
+
klass = klass.to_s
|
40
|
+
klass.split('::').map(&:underscore).join(' ')
|
41
|
+
end
|
42
|
+
|
43
|
+
def stack_instance_exists?(account, region)
|
44
|
+
existing = stack_instances.map do |summary|
|
45
|
+
[summary.account, summary.region]
|
46
|
+
end
|
47
|
+
intersect = existing & [[account, region]]
|
48
|
+
!intersect.empty?
|
49
|
+
end
|
50
|
+
|
51
|
+
end
|
52
|
+
end
|
@@ -1,4 +1,4 @@
|
|
1
|
-
class Lono::
|
1
|
+
class Lono::SetInstances
|
2
2
|
class Sync < Base
|
3
3
|
include Lono::Sets::Summarize
|
4
4
|
include Lono::Utils::Sure
|
@@ -9,6 +9,9 @@ class Lono::Sets::Instances
|
|
9
9
|
end
|
10
10
|
|
11
11
|
def run
|
12
|
+
puts "DEPRECATED: The sync command is deprecated, in favor of the deploy command.".color(:yellow)
|
13
|
+
puts "Found more success with an explicit approach. sync may be removed in future versions of lono."
|
14
|
+
|
12
15
|
unless stack_set_exists?(@stack)
|
13
16
|
puts "ERROR: Cannot update a stack set because #{@stack} does not exists.".color(:red)
|
14
17
|
return
|
@@ -114,8 +117,6 @@ class Lono::Sets::Instances
|
|
114
117
|
operation_id: operation_id,
|
115
118
|
start_on_outdated: meth != :delete_stack_instances,
|
116
119
|
)
|
117
|
-
Lono::Sets::Status::Instance::Base.show_time_progress = true
|
118
|
-
Lono::Sets::Status::Instance::Base.delay_factor = accounts.size * regions.size
|
119
120
|
instances_status = Status.new(o)
|
120
121
|
final_status = meth == :delete_stack_instances ? "deleted" : "completed"
|
121
122
|
instances_status.run(to: final_status) unless @options[:noop] # returns success: true or false
|
@@ -0,0 +1,15 @@
|
|
1
|
+
class Lono::SetInstances
|
2
|
+
class Update < Changeable
|
3
|
+
def perform(options)
|
4
|
+
cfn.update_stack_instances(options)
|
5
|
+
rescue Aws::CloudFormation::Errors::StackInstanceNotFoundException => e
|
6
|
+
puts "#{e.class}: #{e.message}".color(:red)
|
7
|
+
puts <<~EOL
|
8
|
+
One of the provided stack instance was not found. Unable to update the stack instances unless all stack instances
|
9
|
+
already exist. It may be helpful to check the StackSet console Instances Tab. You can also use the
|
10
|
+
`lono set_instances deploy` command instead.
|
11
|
+
EOL
|
12
|
+
exit 1
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
@@ -0,0 +1,54 @@
|
|
1
|
+
module Lono
|
2
|
+
class SetInstances < Lono::Command
|
3
|
+
opts = Opts.new(self)
|
4
|
+
|
5
|
+
desc "create STACK_SET", "Create CloudFormation stack set instances."
|
6
|
+
long_desc Lono::Help.text("set_instances/create")
|
7
|
+
opts.create
|
8
|
+
def create(stack)
|
9
|
+
Create.new(options.merge(stack: stack)).run
|
10
|
+
end
|
11
|
+
|
12
|
+
desc "update STACK_SET", "Update CloudFormation stack set instances."
|
13
|
+
long_desc Lono::Help.text("set_instances/update")
|
14
|
+
opts.update
|
15
|
+
def update(stack)
|
16
|
+
Update.new(options.merge(stack: stack)).run
|
17
|
+
end
|
18
|
+
|
19
|
+
desc "deploy STACK_SET", "Deploy CloudFormation stack set instances"
|
20
|
+
long_desc Lono::Help.text("set_instances/deploy")
|
21
|
+
opts.deploy
|
22
|
+
def deploy(stack)
|
23
|
+
Deploy.new(options.merge(stack: stack)).run
|
24
|
+
end
|
25
|
+
|
26
|
+
desc "delete STACK_SET", "Delete CloudFormation stack set instances."
|
27
|
+
long_desc Lono::Help.text("set_instances/delete")
|
28
|
+
opts.delete
|
29
|
+
def delete(stack)
|
30
|
+
Delete.new(options.merge(stack: stack)).run
|
31
|
+
end
|
32
|
+
|
33
|
+
desc "sync STACK_SET", "Sync CloudFormation stack set instances."
|
34
|
+
long_desc Lono::Help.text("set_instances/sync")
|
35
|
+
opts.sync
|
36
|
+
def sync(stack)
|
37
|
+
Sync.new(options.merge(stack: stack)).run
|
38
|
+
end
|
39
|
+
|
40
|
+
desc "list STACK_SET", "List CloudFormation stack set instances."
|
41
|
+
long_desc Lono::Help.text("set_instances/list")
|
42
|
+
def list(stack)
|
43
|
+
List.new(options.merge(stack: stack)).run
|
44
|
+
end
|
45
|
+
|
46
|
+
desc "status STACK_SET", "Show current status of stack instances."
|
47
|
+
long_desc Lono::Help.text("set_instances/status")
|
48
|
+
def status(stack)
|
49
|
+
instances_status = Status.new(options.merge(stack: stack))
|
50
|
+
success = instances_status.run
|
51
|
+
exit 3 unless success
|
52
|
+
end
|
53
|
+
end
|
54
|
+
end
|
data/lib/lono/sets/create.rb
CHANGED
@@ -19,9 +19,6 @@ class Lono::Sets
|
|
19
19
|
|
20
20
|
options = build_options
|
21
21
|
show_options(options, "cfn.create_stack_set")
|
22
|
-
|
23
|
-
sure?("Are you sure you want to create the #{@stack} stack set?")
|
24
|
-
|
25
22
|
cfn.create_stack_set(options) # resp.stack_set_id => String. There is no resp.operation_id
|
26
23
|
puts message unless @options[:mute]
|
27
24
|
true # There is no resp.operation_id
|
data/lib/lono/sets/delete.rb
CHANGED
@@ -6,7 +6,7 @@ class Lono::Sets
|
|
6
6
|
|
7
7
|
def initialize(options={})
|
8
8
|
@options = options
|
9
|
-
@stack = options
|
9
|
+
@stack = options[:stack]
|
10
10
|
end
|
11
11
|
|
12
12
|
def run
|
@@ -16,35 +16,26 @@ class Lono::Sets
|
|
16
16
|
else
|
17
17
|
desc =<<~EOL
|
18
18
|
Be sure that the emptied StackSet instances is emptied first.
|
19
|
-
You can empty it with a separate command: lono
|
20
|
-
This command will only delete the StackSet itself after
|
19
|
+
You can empty it with a separate command: lono set_instances delete #{@stack} --all
|
20
|
+
This command will only delete the StackSet itself after its been emptied.
|
21
21
|
EOL
|
22
22
|
sure?("Are you sure you want to delete the #{@stack} stack set?", desc)
|
23
23
|
|
24
24
|
if stack_set_exists?(@stack)
|
25
|
-
cfn.delete_stack_set(stack_set_name: @stack) # resp is an Empty structure, so
|
25
|
+
cfn.delete_stack_set(stack_set_name: @stack) # resp is an Empty structure, so must get operation_id from status
|
26
26
|
puts message
|
27
27
|
else
|
28
28
|
puts "#{@stack.inspect} stack set does not exist".color(:red)
|
29
29
|
return
|
30
30
|
end
|
31
31
|
end
|
32
|
-
|
33
|
-
return true if @options[:noop] || !@options[:wait]
|
34
|
-
|
35
|
-
status = Status.new(@options)
|
36
|
-
success = status.wait
|
37
|
-
operation_id = status.operation_id # getting operation_id from status because cfn.delete_stack_set resp is an Empty structure
|
38
|
-
summarize(operation_id)
|
39
|
-
exit 1 unless success
|
40
|
-
|
41
32
|
rescue Aws::CloudFormation::Errors::StackSetNotEmptyException => e
|
42
33
|
puts "ERROR: #{e.class}: #{e.message}".color(:red)
|
43
34
|
puts <<~EOL
|
44
35
|
The stack set must be empty before deleting. Cannot delete stack set until all stack instances are first
|
45
36
|
deleted. If you want to delete all stack instances you can use:
|
46
37
|
|
47
|
-
lono
|
38
|
+
lono set_instances delete #{@stack} --all
|
48
39
|
|
49
40
|
EOL
|
50
41
|
end
|
@@ -11,7 +11,7 @@ class Lono::Sets::Status
|
|
11
11
|
|
12
12
|
def wait(to="completed")
|
13
13
|
puts "Stack Instance statuses... (takes a while)"
|
14
|
-
puts "You can check
|
14
|
+
puts "You can also check with StackSets console at the Operations Tab."
|
15
15
|
wait_until_outdated if @options[:start_on_outdated]
|
16
16
|
|
17
17
|
threads = start_wait_for_instances_threads
|
@@ -23,8 +23,11 @@ class Lono::Sets::Status
|
|
23
23
|
if stack_instances.empty?
|
24
24
|
# Note: no access to @blueprint here
|
25
25
|
puts <<~EOL
|
26
|
-
There are 0 stack instances associated with the #{@stack} stack set.
|
27
|
-
|
26
|
+
There are 0 stack instances associated with the #{@stack} stack set.
|
27
|
+
Use `lono set_instances deploy` to add stack instances. Example:
|
28
|
+
|
29
|
+
lono set_instances deploy #{@stack} --accounts 111 --regions us-west-2 us-east-2
|
30
|
+
|
28
31
|
EOL
|
29
32
|
return
|
30
33
|
end
|
@@ -64,7 +67,7 @@ class Lono::Sets::Status
|
|
64
67
|
sleep 5
|
65
68
|
end
|
66
69
|
end
|
67
|
-
if @show_time_spent # or else it double shows from `lono sets deploy`. Do want it to show for `lono
|
70
|
+
if @show_time_spent # or else it double shows from `lono sets deploy`. Do want it to show for `lono set_instances sync` though
|
68
71
|
show_time_spent(stack_set_operation)
|
69
72
|
puts "Stack set operation completed."
|
70
73
|
end
|
@@ -108,7 +111,7 @@ class Lono::Sets::Status
|
|
108
111
|
resp = cfn.list_stack_instances(stack_set_name: @stack)
|
109
112
|
summaries = resp.summaries
|
110
113
|
# filter is really only used internally. So it's fine to keep it as complex data structure since that's what we
|
111
|
-
# build it up as in Lono::
|
114
|
+
# build it up as in Lono::SetInstances::Deploy
|
112
115
|
filter = @options[:filter] # [["112233445566", "us-west-1"],["112233445566", "us-west-2"]]
|
113
116
|
return summaries unless filter
|
114
117
|
|
data/lib/lono/sets/status.rb
CHANGED
@@ -14,6 +14,9 @@ class Lono::Sets
|
|
14
14
|
end
|
15
15
|
|
16
16
|
def wait
|
17
|
+
Lono::Sets::Status::Instance::Base.show_time_progress = true
|
18
|
+
Lono::Sets::Status::Instance::Base.delay_factor = stack_instances.size
|
19
|
+
|
17
20
|
status = nil
|
18
21
|
until completed?(status)
|
19
22
|
resp = display_one
|
@@ -42,9 +45,14 @@ class Lono::Sets
|
|
42
45
|
end
|
43
46
|
|
44
47
|
def show
|
48
|
+
if summaries.empty?
|
49
|
+
puts "No stack operations have been done with this stack set. So there is no status to report."
|
50
|
+
return
|
51
|
+
end
|
52
|
+
|
45
53
|
display_one
|
46
54
|
o = @options.merge(show_time_spent: false)
|
47
|
-
instances_status = Lono::
|
55
|
+
instances_status = Lono::SetInstances::Status.new(o)
|
48
56
|
instances_status.run
|
49
57
|
summarize(operation_id)
|
50
58
|
end
|
@@ -60,7 +68,7 @@ class Lono::Sets
|
|
60
68
|
Thread.new do
|
61
69
|
# show_time_spent because we already show it in this status class. Dont want it to show twice.
|
62
70
|
o = @options.merge(start_on_outdated: true, show_time_spent: false)
|
63
|
-
instances_status = Lono::
|
71
|
+
instances_status = Lono::SetInstances::Status.new(o)
|
64
72
|
instances_status.run
|
65
73
|
end
|
66
74
|
@@instances_status_waiter_started = true
|
@@ -101,11 +109,15 @@ class Lono::Sets
|
|
101
109
|
end
|
102
110
|
|
103
111
|
def latest_operation_id
|
112
|
+
summaries.first.operation_id
|
113
|
+
end
|
114
|
+
|
115
|
+
def summaries
|
104
116
|
resp = cfn.list_stack_set_operations(
|
105
117
|
stack_set_name: @stack,
|
106
118
|
max_results: 1,
|
107
119
|
)
|
108
|
-
resp.summaries
|
120
|
+
resp.summaries
|
109
121
|
end
|
110
122
|
|
111
123
|
def stack_instances
|
data/lib/lono/sets/summarize.rb
CHANGED
data/lib/lono/sets/update.rb
CHANGED
@@ -26,26 +26,19 @@ class Lono::Sets
|
|
26
26
|
puts <<~EOL
|
27
27
|
NOTE: There are 0 stack instances associated with the #{@stack} stack set.
|
28
28
|
Will update the stack set template but there no instances to be updated.
|
29
|
-
|
30
|
-
|
29
|
+
|
30
|
+
Use `lono set_instances deploy` to add stack instances. Example:
|
31
|
+
|
32
|
+
lono set_instances deploy #{@stack} --accounts 111 --regions us-west-2 us-east-2
|
33
|
+
|
31
34
|
EOL
|
32
35
|
else
|
33
36
|
sure?("Are you sure you want to update the #{@stack} stack set?", long_desc)
|
34
37
|
end
|
35
38
|
|
36
39
|
resp = cfn.update_stack_set(options)
|
37
|
-
operation_id = resp[:operation_id]
|
38
|
-
puts message unless @options[:mute]
|
39
|
-
|
40
|
-
return true if @options[:noop] || !@options[:wait]
|
41
40
|
|
42
|
-
Lono::Sets::
|
43
|
-
Lono::Sets::Status::Instance::Base.delay_factor = stack_instances.size
|
44
|
-
status = Status.new(@options.merge(operation_id: operation_id))
|
45
|
-
success = status.wait
|
46
|
-
summarize(operation_id)
|
47
|
-
exit 1 unless success
|
48
|
-
success
|
41
|
+
Lono::Sets::Waiter.new(@options).run(resp[:operation_id])
|
49
42
|
end
|
50
43
|
|
51
44
|
def stack_instances
|
@@ -0,0 +1,23 @@
|
|
1
|
+
class Lono::Sets
|
2
|
+
class Waiter
|
3
|
+
include Lono::Sets::Summarize
|
4
|
+
|
5
|
+
def initialize(options)
|
6
|
+
@options = options
|
7
|
+
@stack = options[:stack]
|
8
|
+
@wait = @options[:wait].nil? ? true : @options[:wait]
|
9
|
+
end
|
10
|
+
|
11
|
+
def run(operation_id)
|
12
|
+
message = "Deploying #{@stack} stack set"
|
13
|
+
puts message unless @options[:mute]
|
14
|
+
return unless @wait
|
15
|
+
|
16
|
+
status = Status.new(@options.merge(operation_id: operation_id))
|
17
|
+
success = status.wait
|
18
|
+
summarize(operation_id)
|
19
|
+
exit 1 unless success
|
20
|
+
success
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
data/lib/lono/sets.rb
CHANGED
@@ -31,9 +31,10 @@ module Lono::Template::Strategy::Dsl::Builder::Helpers
|
|
31
31
|
end
|
32
32
|
|
33
33
|
def lookup_output(name)
|
34
|
-
stack_output(name)
|
34
|
+
result = stack_output(name)
|
35
35
|
return unless ENV['LONO_DEPRECATION_SOFT']
|
36
36
|
puts "DEPRECATION WARNING: lookup_output is deprecated. Please use stack_output instead".color(:yellow)
|
37
|
+
result
|
37
38
|
end
|
38
39
|
|
39
40
|
private
|
data/lib/lono/version.rb
CHANGED
data/lib/lono.rb
CHANGED
data/lono.gemspec
CHANGED
@@ -41,6 +41,7 @@ Gem::Specification.new do |gem|
|
|
41
41
|
gem.add_dependency "rainbow"
|
42
42
|
gem.add_dependency "rb-fsevent"
|
43
43
|
gem.add_dependency "render_me_pretty"
|
44
|
+
gem.add_dependency "rexml"
|
44
45
|
gem.add_dependency "text-table"
|
45
46
|
gem.add_dependency "thor"
|
46
47
|
gem.add_dependency "zeitwerk"
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: lono
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 7.
|
4
|
+
version: 7.5.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tung Nguyen
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2022-02-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|
@@ -304,6 +304,20 @@ dependencies:
|
|
304
304
|
- - ">="
|
305
305
|
- !ruby/object:Gem::Version
|
306
306
|
version: '0'
|
307
|
+
- !ruby/object:Gem::Dependency
|
308
|
+
name: rexml
|
309
|
+
requirement: !ruby/object:Gem::Requirement
|
310
|
+
requirements:
|
311
|
+
- - ">="
|
312
|
+
- !ruby/object:Gem::Version
|
313
|
+
version: '0'
|
314
|
+
type: :runtime
|
315
|
+
prerelease: false
|
316
|
+
version_requirements: !ruby/object:Gem::Requirement
|
317
|
+
requirements:
|
318
|
+
- - ">="
|
319
|
+
- !ruby/object:Gem::Version
|
320
|
+
version: '0'
|
307
321
|
- !ruby/object:Gem::Dependency
|
308
322
|
name: text-table
|
309
323
|
requirement: !ruby/object:Gem::Requirement
|
@@ -577,12 +591,13 @@ files:
|
|
577
591
|
- lib/lono/help/script/build.md
|
578
592
|
- lib/lono/help/script/upload.md
|
579
593
|
- lib/lono/help/seed.md
|
594
|
+
- lib/lono/help/set_instances/delete.md
|
595
|
+
- lib/lono/help/set_instances/deploy.md
|
596
|
+
- lib/lono/help/set_instances/list.md
|
597
|
+
- lib/lono/help/set_instances/status.md
|
598
|
+
- lib/lono/help/set_instances/sync.md
|
580
599
|
- lib/lono/help/sets/delete.md
|
581
600
|
- lib/lono/help/sets/deploy.md
|
582
|
-
- lib/lono/help/sets/instances/delete.md
|
583
|
-
- lib/lono/help/sets/instances/list.md
|
584
|
-
- lib/lono/help/sets/instances/status.md
|
585
|
-
- lib/lono/help/sets/instances/sync.md
|
586
601
|
- lib/lono/help/sets/status.md
|
587
602
|
- lib/lono/help/summary.md
|
588
603
|
- lib/lono/help/template.md
|
@@ -639,18 +654,22 @@ files:
|
|
639
654
|
- lib/lono/seed/base.rb
|
640
655
|
- lib/lono/seed/service_role.rb
|
641
656
|
- lib/lono/sequence.rb
|
657
|
+
- lib/lono/set_instances.rb
|
658
|
+
- lib/lono/set_instances/base.rb
|
659
|
+
- lib/lono/set_instances/changeable.rb
|
660
|
+
- lib/lono/set_instances/create.rb
|
661
|
+
- lib/lono/set_instances/delete.rb
|
662
|
+
- lib/lono/set_instances/deploy.rb
|
663
|
+
- lib/lono/set_instances/list.rb
|
664
|
+
- lib/lono/set_instances/opts.rb
|
665
|
+
- lib/lono/set_instances/status.rb
|
666
|
+
- lib/lono/set_instances/sync.rb
|
667
|
+
- lib/lono/set_instances/update.rb
|
642
668
|
- lib/lono/sets.rb
|
643
669
|
- lib/lono/sets/base.rb
|
644
670
|
- lib/lono/sets/create.rb
|
645
671
|
- lib/lono/sets/delete.rb
|
646
672
|
- lib/lono/sets/deploy.rb
|
647
|
-
- lib/lono/sets/instances.rb
|
648
|
-
- lib/lono/sets/instances/base.rb
|
649
|
-
- lib/lono/sets/instances/delete.rb
|
650
|
-
- lib/lono/sets/instances/list.rb
|
651
|
-
- lib/lono/sets/instances/opts.rb
|
652
|
-
- lib/lono/sets/instances/status.rb
|
653
|
-
- lib/lono/sets/instances/sync.rb
|
654
673
|
- lib/lono/sets/list.rb
|
655
674
|
- lib/lono/sets/opts.rb
|
656
675
|
- lib/lono/sets/preview/codediff.rb
|
@@ -665,6 +684,7 @@ files:
|
|
665
684
|
- lib/lono/sets/summarize.rb
|
666
685
|
- lib/lono/sets/time_spent.rb
|
667
686
|
- lib/lono/sets/update.rb
|
687
|
+
- lib/lono/sets/waiter.rb
|
668
688
|
- lib/lono/setting.rb
|
669
689
|
- lib/lono/template.rb
|
670
690
|
- lib/lono/template/aws_service.rb
|
@@ -804,7 +824,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
804
824
|
- !ruby/object:Gem::Version
|
805
825
|
version: '0'
|
806
826
|
requirements: []
|
807
|
-
rubygems_version: 3.
|
827
|
+
rubygems_version: 3.2.32
|
808
828
|
signing_key:
|
809
829
|
specification_version: 4
|
810
830
|
summary: The CloudFormation Framework
|
data/lib/lono/sets/instances.rb
DELETED
@@ -1,33 +0,0 @@
|
|
1
|
-
class Lono::Sets
|
2
|
-
class Instances < Lono::Command
|
3
|
-
opts = Opts.new(self)
|
4
|
-
|
5
|
-
desc "delete STACK_SET", "Delete CloudFormation stack set instances."
|
6
|
-
long_desc Lono::Help.text("sets/instances/delete")
|
7
|
-
opts.delete
|
8
|
-
def delete(stack)
|
9
|
-
Delete.new(options.merge(stack: stack)).run
|
10
|
-
end
|
11
|
-
|
12
|
-
desc "sync STACK_SET", "Sync CloudFormation stack set instances."
|
13
|
-
long_desc Lono::Help.text("sets/instances/sync")
|
14
|
-
opts.sync
|
15
|
-
def sync(stack)
|
16
|
-
Sync.new(options.merge(stack: stack)).run
|
17
|
-
end
|
18
|
-
|
19
|
-
desc "list STACK_SET", "List CloudFormation stack set instances."
|
20
|
-
long_desc Lono::Help.text("sets/instances/list")
|
21
|
-
def list(stack)
|
22
|
-
List.new(options.merge(stack: stack)).run
|
23
|
-
end
|
24
|
-
|
25
|
-
desc "status STACK_SET", "Show current status of stack instances."
|
26
|
-
long_desc Lono::Help.text("sets/instances/status")
|
27
|
-
def status(stack)
|
28
|
-
instances_status = Status.new(options.merge(stack: stack))
|
29
|
-
success = instances_status.run
|
30
|
-
exit 3 unless success
|
31
|
-
end
|
32
|
-
end
|
33
|
-
end
|