lono 5.1.1 → 5.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +7 -0
- data/lib/lono/app_file/base.rb +1 -1
- data/lib/lono/aws_services/util.rb +1 -1
- data/lib/lono/blueprint/root.rb +5 -3
- data/lib/lono/cfn/base.rb +1 -5
- data/lib/lono/cfn/cancel.rb +36 -0
- data/lib/lono/cfn/delete.rb +30 -32
- data/lib/lono/cfn/diff.rb +40 -38
- data/lib/lono/cfn/download.rb +25 -23
- data/lib/lono/cfn/preview.rb +129 -127
- data/lib/lono/cfn/status.rb +2 -0
- data/lib/lono/cfn/util.rb +21 -15
- data/lib/lono/cfn.rb +109 -102
- data/lib/lono/cli.rb +3 -4
- data/lib/lono/core/config.rb +1 -0
- data/lib/lono/help/cfn/cancel.md +13 -0
- data/lib/lono/help/seed.md +16 -0
- data/lib/lono/inspector.rb +3 -6
- data/lib/lono/param/generator.rb +181 -179
- data/lib/lono/param.rb +2 -4
- data/lib/lono/s3/bucket.rb +38 -3
- data/lib/lono/script/base.rb +1 -1
- data/lib/lono/seed/base.rb +148 -0
- data/lib/lono/seed.rb +35 -24
- data/lib/lono/template/dsl/builder/helper.rb +12 -4
- data/lib/lono/template/dsl/builder.rb +11 -1
- data/lib/lono/template.rb +1 -4
- data/lib/lono/upgrade.rb +14 -14
- data/lib/lono/version.rb +1 -1
- data/lib/templates/blueprint/seed/configs.rb +12 -38
- data/lono.gemspec +1 -0
- data/vendor/cfn-status/lib/cfn/aws_service.rb +1 -1
- metadata +20 -7
- data/lib/lono/cfn/aws_service.rb +0 -53
- data/lib/lono/configure/aws_services.rb +0 -18
- data/lib/lono/configure/base.rb +0 -94
- data/lib/lono/configure/helpers.rb +0 -128
- data/lib/templates/blueprint/.lono/config.yml.tt +0 -3
data/lib/lono/cfn/util.rb
CHANGED
@@ -1,21 +1,27 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
sure
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
1
|
+
class Lono::Cfn
|
2
|
+
module Util
|
3
|
+
def are_you_sure?(stack_name, action)
|
4
|
+
if @options[:sure]
|
5
|
+
sure = 'y'
|
6
|
+
else
|
7
|
+
message = case action
|
8
|
+
when :update
|
9
|
+
"Are you sure you want to want to update the #{stack_name.color(:green)} stack with the changes? (y/N)"
|
10
|
+
when :delete
|
11
|
+
"Are you sure you want to want to delete the #{stack_name.color(:green)} stack? (y/N)"
|
12
|
+
end
|
13
|
+
puts message
|
14
|
+
sure = $stdin.gets
|
15
|
+
end
|
16
|
+
|
17
|
+
unless sure =~ /^y/
|
18
|
+
puts "Whew! Exiting without running #{action}."
|
19
|
+
exit 0
|
11
20
|
end
|
12
|
-
puts message
|
13
|
-
sure = $stdin.gets
|
14
21
|
end
|
15
22
|
|
16
|
-
|
17
|
-
|
18
|
-
exit 0
|
23
|
+
def switch_current(stack_name)
|
24
|
+
Current.name!(stack_name)
|
19
25
|
end
|
20
26
|
end
|
21
27
|
end
|
data/lib/lono/cfn.rb
CHANGED
@@ -1,114 +1,121 @@
|
|
1
|
-
|
2
|
-
|
1
|
+
module Lono
|
2
|
+
class Cfn < Command
|
3
|
+
class_option :verbose, type: :boolean
|
4
|
+
class_option :noop, type: :boolean
|
3
5
|
|
4
|
-
|
5
|
-
|
6
|
-
|
6
|
+
base_options = Proc.new do
|
7
|
+
# common to create and update
|
8
|
+
option :blueprint, desc: "override convention and specify the template file to use"
|
9
|
+
option :template, desc: "override convention and specify the template file to use"
|
10
|
+
option :param, desc: "override convention and specify the param file to use"
|
11
|
+
option :lono, type: :boolean, desc: "invoke lono to generate CloudFormation templates", default: true
|
12
|
+
option :capabilities, type: :array, desc: "iam capabilities. Ex: CAPABILITY_IAM, CAPABILITY_NAMED_IAM"
|
13
|
+
option :iam, type: :boolean, desc: "Shortcut for common IAM capabilities: CAPABILITY_IAM, CAPABILITY_NAMED_IAM"
|
14
|
+
option :rollback, type: :boolean, desc: "rollback", default: true
|
15
|
+
option :tags, type: :hash, desc: "Tags for the stack. IE: name:api-web owner:bob"
|
16
|
+
end
|
17
|
+
wait_option = Proc.new do
|
18
|
+
option :wait, type: :boolean, desc: "Wait for stack operation to complete.", default: true
|
19
|
+
end
|
20
|
+
suffix_option = Proc.new do
|
21
|
+
option :suffix, desc: "Suffix for stack name."
|
22
|
+
end
|
23
|
+
update_options = Proc.new do
|
24
|
+
option :change_set, type: :boolean, default: true, desc: "Uses generated change set to update the stack. If false, will perform normal update-stack."
|
25
|
+
option :diff, type: :boolean, default: true, desc: "Show diff of the source code template changes before continuing."
|
26
|
+
option :preview, type: :boolean, default: true, desc: "Show preview of the stack changes before continuing."
|
27
|
+
option :sure, type: :boolean, desc: "Skips are you sure prompt"
|
28
|
+
end
|
7
29
|
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
option :rollback, type: :boolean, desc: "rollback", default: true
|
17
|
-
option :tags, type: :hash, desc: "Tags for the stack. IE: name:api-web owner:bob"
|
18
|
-
end
|
19
|
-
wait_option = Proc.new do
|
20
|
-
option :wait, type: :boolean, desc: "Wait for stack operation to complete.", default: true
|
21
|
-
end
|
22
|
-
suffix_option = Proc.new do
|
23
|
-
option :suffix, desc: "Suffix for stack name."
|
24
|
-
end
|
25
|
-
update_options = Proc.new do
|
26
|
-
option :change_set, type: :boolean, default: true, desc: "Uses generated change set to update the stack. If false, will perform normal update-stack."
|
27
|
-
option :diff, type: :boolean, default: true, desc: "Show diff of the source code template changes before continuing."
|
28
|
-
option :preview, type: :boolean, default: true, desc: "Show preview of the stack changes before continuing."
|
29
|
-
option :sure, type: :boolean, desc: "Skips are you sure prompt"
|
30
|
-
end
|
30
|
+
desc "create STACK", "Create a CloudFormation stack using the generated template."
|
31
|
+
base_options.call
|
32
|
+
suffix_option.call
|
33
|
+
wait_option.call
|
34
|
+
long_desc Lono::Help.text("cfn/create")
|
35
|
+
def create(stack_name)
|
36
|
+
Create.new(stack_name, options).run
|
37
|
+
end
|
31
38
|
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
39
|
+
desc "update STACK", "Update a CloudFormation stack using the generated template."
|
40
|
+
long_desc Lono::Help.text("cfn/update")
|
41
|
+
base_options.call
|
42
|
+
update_options.call
|
43
|
+
wait_option.call
|
44
|
+
def update(stack_name=:current)
|
45
|
+
Update.new(stack_name, options).run
|
46
|
+
end
|
40
47
|
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
48
|
+
desc "deploy STACK", "Create or update a CloudFormation stack using the generated template."
|
49
|
+
long_desc Lono::Help.text("cfn/deploy")
|
50
|
+
base_options.call
|
51
|
+
suffix_option.call
|
52
|
+
update_options.call
|
53
|
+
wait_option.call
|
54
|
+
def deploy(stack_name=:current)
|
55
|
+
Deploy.new(stack_name, options).run
|
56
|
+
end
|
49
57
|
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
end
|
58
|
+
desc "delete STACK", "Delete a CloudFormation stack."
|
59
|
+
long_desc Lono::Help.text("cfn/delete")
|
60
|
+
option :sure, type: :boolean, desc: "Skips are you sure prompt"
|
61
|
+
base_options.call
|
62
|
+
wait_option.call
|
63
|
+
def delete(stack_name=:current)
|
64
|
+
Delete.new(stack_name, options).run
|
65
|
+
end
|
59
66
|
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
end
|
67
|
+
desc "cancel STACK", "Cancel a CloudFormation stack."
|
68
|
+
long_desc Lono::Help.text("cfn/cancel")
|
69
|
+
option :sure, type: :boolean, desc: "Skips are you sure prompt"
|
70
|
+
wait_option.call
|
71
|
+
def cancel(stack_name=:current)
|
72
|
+
Cancel.new(stack_name, options).run
|
73
|
+
end
|
68
74
|
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
75
|
+
desc "preview STACK", "Preview a CloudFormation stack update. This is similar to terraform's plan or puppet's dry-run mode."
|
76
|
+
long_desc Lono::Help.text("cfn/preview")
|
77
|
+
option :keep, type: :boolean, desc: "keep the changeset instead of deleting it afterwards"
|
78
|
+
option :diff, type: :boolean, default: true, desc: "Show diff of the source code template changes also."
|
79
|
+
base_options.call
|
80
|
+
suffix_option.call
|
81
|
+
def preview(stack_name=:current)
|
82
|
+
Diff.new(stack_name, options).run if options[:diff]
|
83
|
+
Preview.new(stack_name, options).run
|
84
|
+
end
|
79
85
|
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
86
|
+
desc "diff STACK", "Diff newly generated template vs existing template."
|
87
|
+
long_desc Lono::Help.text("cfn/diff")
|
88
|
+
base_options.call
|
89
|
+
suffix_option.call
|
90
|
+
def diff(stack_name=:current)
|
91
|
+
Diff.new(stack_name, options).run
|
92
|
+
end
|
87
93
|
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
94
|
+
desc "download STACK", "Download CloudFormation template from existing stack."
|
95
|
+
long_desc Lono::Help.text("cfn/download")
|
96
|
+
option :name, desc: "Name you want to save the template as. Default: existing stack name."
|
97
|
+
base_options.call
|
98
|
+
suffix_option.call
|
99
|
+
def download(stack_name=:current)
|
100
|
+
Download.new(stack_name, options).run
|
101
|
+
end
|
96
102
|
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
103
|
+
desc "current", "Current stack that you're working with."
|
104
|
+
long_desc Lono::Help.text("cfn/current")
|
105
|
+
option :rm, type: :boolean, desc: "Remove all current settings. Removes `.lono/current`"
|
106
|
+
option :name, desc: "Current stack name."
|
107
|
+
suffix_option.call
|
108
|
+
def current
|
109
|
+
Current.new(options).run
|
110
|
+
end
|
105
111
|
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
112
|
+
desc "status", "Shows the current status for the stack."
|
113
|
+
long_desc Lono::Help.text("cfn/status")
|
114
|
+
suffix_option.call
|
115
|
+
def status(stack_name=:current)
|
116
|
+
status = Lono::Cfn::Status.new(stack_name, options)
|
117
|
+
success = status.run
|
118
|
+
exit 3 unless success
|
119
|
+
end
|
113
120
|
end
|
114
|
-
end
|
121
|
+
end
|
data/lib/lono/cli.rb
CHANGED
@@ -48,13 +48,12 @@ module Lono
|
|
48
48
|
Lono::Inspector::Graph.new(blueprint, template, options).run
|
49
49
|
end
|
50
50
|
|
51
|
-
desc "seed", "
|
52
|
-
|
51
|
+
desc "seed", "Generates starter configs for a blueprint."
|
52
|
+
long_desc Help.text("seed")
|
53
53
|
option :param, desc: "override convention and specify the param file to use"
|
54
|
-
option :seed, default: :convention, desc: "path to seed file to allow prompts bypass. yaml format."
|
55
54
|
option :template, desc: "override convention and specify the template file to use"
|
56
55
|
def seed(blueprint)
|
57
|
-
Seed.new(blueprint, options).
|
56
|
+
Seed.new(blueprint, options).create
|
58
57
|
end
|
59
58
|
|
60
59
|
desc "clean", "Removes `output` folder."
|
data/lib/lono/core/config.rb
CHANGED
@@ -0,0 +1,13 @@
|
|
1
|
+
## Examples
|
2
|
+
|
3
|
+
$ lono cfn cancel demo
|
4
|
+
Canceling updates to demo.
|
5
|
+
Current stack status: UPDATE_IN_PROGRESS
|
6
|
+
Canceling stack update.
|
7
|
+
Waiting for stack to complete
|
8
|
+
01:20:32PM UPDATE_ROLLBACK_IN_PROGRESS AWS::CloudFormation::Stack demo User Initiated
|
9
|
+
01:20:44PM UPDATE_ROLLBACK_COMPLETE_CLEANUP_IN_PROGRESS AWS::CloudFormation::Stack demo
|
10
|
+
01:20:44PM UPDATE_ROLLBACK_COMPLETE AWS::CloudFormation::Stack demo
|
11
|
+
Stack rolled back: UPDATE_ROLLBACK_COMPLETE
|
12
|
+
Time took for stack deployment: 15s.
|
13
|
+
$
|
@@ -0,0 +1,16 @@
|
|
1
|
+
## Example
|
2
|
+
|
3
|
+
$ lono seed ecs-asg
|
4
|
+
Creating starter config files for ecs-asg
|
5
|
+
Starter params created: configs/ecs-asg/params/development.txt
|
6
|
+
$ cat configs/ecs-asg/params/development.txt
|
7
|
+
# Required parameters:
|
8
|
+
VpcId=vpc-111
|
9
|
+
Subnets=subnet-111,subnet-222,subnet-333
|
10
|
+
EcsCluster=development
|
11
|
+
# Optional parameters:
|
12
|
+
# InstanceType=m5.large
|
13
|
+
# KeyName=...
|
14
|
+
# SshLocation=...
|
15
|
+
# TagName=ecs-asg
|
16
|
+
$
|
data/lib/lono/inspector.rb
CHANGED