knife-cfn 0.1.10 → 0.1.11
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.
- checksums.yaml +7 -0
- data/lib/chef/knife/cfn_base.rb +101 -16
- data/lib/chef/knife/cfn_create.rb +125 -125
- data/lib/chef/knife/cfn_delete.rb +61 -21
- data/lib/chef/knife/cfn_describe.rb +40 -0
- data/lib/chef/knife/cfn_events.rb +53 -13
- data/lib/chef/knife/cfn_outputs.rb +148 -108
- data/lib/chef/knife/cfn_resources.rb +126 -86
- data/lib/chef/knife/cfn_update.rb +66 -26
- data/lib/chef/knife/cfn_validate.rb +55 -16
- data/lib/knife-cfn/version.rb +3 -3
- metadata +13 -19
@@ -26,15 +26,15 @@ class Chef
|
|
26
26
|
require 'chef/knife/bootstrap'
|
27
27
|
Chef::Knife::Bootstrap.load_deps
|
28
28
|
end
|
29
|
-
|
29
|
+
|
30
30
|
banner "knife cfn update <stack name> (options)"
|
31
|
-
|
31
|
+
|
32
32
|
option :capabilities,
|
33
33
|
:short => "-c CAPABILITY..",
|
34
34
|
:long => "--capabilities CAPABILITY1,CAPABILITY2,CAPABILITY3..",
|
35
35
|
:description => "The explicitly approved capabilities that may be used during this stack creation",
|
36
|
-
:proc => Proc.new { |capabilities| capabilities.split(',') }
|
37
|
-
|
36
|
+
:proc => Proc.new { |capabilities| capabilities.split(',') }
|
37
|
+
|
38
38
|
option :disable_rollback,
|
39
39
|
:short => "-d",
|
40
40
|
:long => "--disable-rollback",
|
@@ -46,44 +46,84 @@ class Chef
|
|
46
46
|
:long => "--template-file TEMPLATE_FILE",
|
47
47
|
:description => "Path to the file that contains the template",
|
48
48
|
:proc => Proc.new { |f| Chef::Config[:knife][:template_file] = f }
|
49
|
-
|
49
|
+
|
50
50
|
option :notification_arns,
|
51
51
|
:short => "-n NOTIFICATION_ARN1,NOTIFICATION_ARN2,NOTIFICATION_ARN3..",
|
52
52
|
:long => "--notification-arns VALUE1,VALUE2,VALUE3..",
|
53
53
|
:description => "SNS ARNs to receive notification about the stack",
|
54
54
|
:proc => Proc.new { |notification_arns| notification_arns.split(',') }
|
55
|
-
|
55
|
+
|
56
56
|
option :parameters,
|
57
57
|
:short => "-p 'key1=value1;key2=value2...'",
|
58
58
|
:long => "--parameters 'key1=value1;key2=value2...'",
|
59
59
|
:description => "Parameter values used to update the stack",
|
60
60
|
:proc => Proc.new { |parameters| parameters.split(';') }
|
61
|
-
|
61
|
+
|
62
62
|
option :timeout,
|
63
63
|
:short => "-t TIMEOUT_VALUE",
|
64
64
|
:long => "--timeout TIMEOUT_VALUE",
|
65
65
|
:description => " Stack update timeout in minutes",
|
66
|
-
:proc => Proc.new { |t| Chef::Config[:knife][:timeout] = t }
|
67
|
-
|
66
|
+
:proc => Proc.new { |t| Chef::Config[:knife][:timeout] = t }
|
67
|
+
|
68
68
|
option :template_url,
|
69
69
|
:short => "-u TEMPLATE_URL",
|
70
70
|
:long => "--template-file TEMPLATE_URL",
|
71
71
|
:description => "Path of the URL that contains the template. This must be a reference to a template in an S3 bucket in the same region that the stack was created in",
|
72
72
|
:proc => Proc.new { |u| Chef::Config[:knife][:template_url] = u }
|
73
|
-
|
73
|
+
|
74
|
+
option :aws_credential_file,
|
75
|
+
:long => "--aws-credential-file FILE",
|
76
|
+
:description => "File containing AWS credentials as used by aws cmdline tools",
|
77
|
+
:proc => Proc.new { |key| Chef::Config[:knife][:aws_credential_file] = key }
|
78
|
+
|
79
|
+
option :aws_profile,
|
80
|
+
:long => "--aws-profile PROFILE",
|
81
|
+
:description => "AWS profile, from credential file, to use",
|
82
|
+
:default => 'default',
|
83
|
+
:proc => Proc.new { |key| Chef::Config[:knife][:aws_profile] = key }
|
84
|
+
|
85
|
+
option :aws_access_key_id,
|
86
|
+
:short => "-A ID",
|
87
|
+
:long => "--aws-access-key-id KEY",
|
88
|
+
:description => "Your AWS Access Key ID",
|
89
|
+
:proc => Proc.new { |key| Chef::Config[:knife][:aws_access_key_id] = key }
|
90
|
+
|
91
|
+
option :aws_secret_access_key,
|
92
|
+
:short => "-K SECRET",
|
93
|
+
:long => "--aws-secret-access-key SECRET",
|
94
|
+
:description => "Your AWS API Secret Access Key",
|
95
|
+
:proc => Proc.new { |key| Chef::Config[:knife][:aws_secret_access_key] = key }
|
96
|
+
|
97
|
+
option :aws_session_token,
|
98
|
+
:long => "--aws-session-token TOKEN",
|
99
|
+
:description => "Your AWS Session Token, for use with AWS STS Federation or Session Tokens",
|
100
|
+
:proc => Proc.new { |key| Chef::Config[:knife][:aws_session_token] = key }
|
101
|
+
|
102
|
+
option :region,
|
103
|
+
:long => "--region REGION",
|
104
|
+
:description => "Your AWS region",
|
105
|
+
:proc => Proc.new { |key| Chef::Config[:knife][:region] = key }
|
106
|
+
|
107
|
+
option :use_iam_profile,
|
108
|
+
:long => "--use-iam-profile",
|
109
|
+
:description => "Use IAM profile assigned to current machine",
|
110
|
+
:boolean => true,
|
111
|
+
:default => false,
|
112
|
+
:proc => Proc.new { |key| Chef::Config[:knife][:use_iam_profile] = key }
|
113
|
+
|
74
114
|
def run
|
75
115
|
$stdout.sync = true
|
76
116
|
|
77
117
|
validate!
|
78
|
-
|
118
|
+
|
79
119
|
stack_name = @name_args[0]
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
120
|
+
|
121
|
+
if stack_name.nil?
|
122
|
+
show_usage
|
123
|
+
ui.error("You must specify a stack name")
|
84
124
|
exit 1
|
85
|
-
|
86
|
-
|
125
|
+
end
|
126
|
+
|
87
127
|
begin
|
88
128
|
response = connection.update_stack(stack_name, create_update_def)
|
89
129
|
rescue Excon::Errors::BadRequest => e
|
@@ -99,18 +139,18 @@ class Chef
|
|
99
139
|
message = "Stack #{stack_name} update started"
|
100
140
|
print "\n#{ui.color(message, :green)}\n"
|
101
141
|
end
|
102
|
-
end
|
103
|
-
end
|
104
|
-
|
142
|
+
end
|
143
|
+
end
|
144
|
+
|
105
145
|
def create_update_def
|
106
|
-
create_def = {}
|
146
|
+
create_def = {}
|
107
147
|
template_file = locate_config_value(:template_file)
|
108
148
|
if template_file != nil and template_file != ""
|
109
149
|
doc = File.open(template_file, 'rb') { |file| file.read }
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
150
|
+
create_def['TemplateBody'] = doc
|
151
|
+
end
|
152
|
+
create_def['TemplateURL'] = locate_config_value(:template_url)
|
153
|
+
create_def['Capabilities'] = locate_config_value(:capabilities)
|
114
154
|
create_def['DisableRollback'] = locate_config_value(:disable_rollback)
|
115
155
|
create_def['NotificationARNs'] = locate_config_value(:notification_arns)
|
116
156
|
hashed_parameters={}
|
@@ -120,6 +160,6 @@ class Chef
|
|
120
160
|
create_def['TimeoutInMinutes'] = locate_config_value(:timeout)
|
121
161
|
create_def
|
122
162
|
end
|
123
|
-
|
163
|
+
|
124
164
|
end
|
125
165
|
end
|
@@ -18,7 +18,7 @@ require 'chef/knife/cfn_base'
|
|
18
18
|
class Chef
|
19
19
|
class Knife
|
20
20
|
class CfnValidate < Chef::Knife::CfnBase
|
21
|
-
|
21
|
+
|
22
22
|
deps do
|
23
23
|
require 'fog'
|
24
24
|
require 'readline'
|
@@ -26,7 +26,7 @@ class Chef
|
|
26
26
|
require 'chef/knife/bootstrap'
|
27
27
|
Chef::Knife::Bootstrap.load_deps
|
28
28
|
end
|
29
|
-
|
29
|
+
|
30
30
|
banner "knife cfn validate (options)"
|
31
31
|
|
32
32
|
option :template_file,
|
@@ -34,23 +34,62 @@ class Chef
|
|
34
34
|
:long => "--template-file TEMPLATE_FILE",
|
35
35
|
:description => "Path to the file that contains the template",
|
36
36
|
:proc => Proc.new { |f| Chef::Config[:knife][:template_file] = f }
|
37
|
-
|
37
|
+
|
38
38
|
option :template_url,
|
39
39
|
:short => "-u TEMPLATE_URL",
|
40
40
|
:long => "--template-file TEMPLATE_URL",
|
41
41
|
:description => "Path to the URL that contains the template",
|
42
42
|
:proc => Proc.new { |u| Chef::Config[:knife][:template_url] = u }
|
43
|
-
|
43
|
+
|
44
|
+
option :aws_credential_file,
|
45
|
+
:long => "--aws-credential-file FILE",
|
46
|
+
:description => "File containing AWS credentials as used by aws cmdline tools",
|
47
|
+
:proc => Proc.new { |key| Chef::Config[:knife][:aws_credential_file] = key }
|
48
|
+
|
49
|
+
option :aws_profile,
|
50
|
+
:long => "--aws-profile PROFILE",
|
51
|
+
:description => "AWS profile, from credential file, to use",
|
52
|
+
:default => 'default',
|
53
|
+
:proc => Proc.new { |key| Chef::Config[:knife][:aws_profile] = key }
|
54
|
+
|
55
|
+
option :aws_access_key_id,
|
56
|
+
:short => "-A ID",
|
57
|
+
:long => "--aws-access-key-id KEY",
|
58
|
+
:description => "Your AWS Access Key ID",
|
59
|
+
:proc => Proc.new { |key| Chef::Config[:knife][:aws_access_key_id] = key }
|
60
|
+
|
61
|
+
option :aws_secret_access_key,
|
62
|
+
:short => "-K SECRET",
|
63
|
+
:long => "--aws-secret-access-key SECRET",
|
64
|
+
:description => "Your AWS API Secret Access Key",
|
65
|
+
:proc => Proc.new { |key| Chef::Config[:knife][:aws_secret_access_key] = key }
|
66
|
+
|
67
|
+
option :aws_session_token,
|
68
|
+
:long => "--aws-session-token TOKEN",
|
69
|
+
:description => "Your AWS Session Token, for use with AWS STS Federation or Session Tokens",
|
70
|
+
:proc => Proc.new { |key| Chef::Config[:knife][:aws_session_token] = key }
|
71
|
+
|
72
|
+
option :region,
|
73
|
+
:long => "--region REGION",
|
74
|
+
:description => "Your AWS region",
|
75
|
+
:proc => Proc.new { |key| Chef::Config[:knife][:region] = key }
|
76
|
+
|
77
|
+
option :use_iam_profile,
|
78
|
+
:long => "--use-iam-profile",
|
79
|
+
:description => "Use IAM profile assigned to current machine",
|
80
|
+
:boolean => true,
|
81
|
+
:default => false,
|
82
|
+
:proc => Proc.new { |key| Chef::Config[:knife][:use_iam_profile] = key }
|
44
83
|
|
45
84
|
def run
|
46
85
|
$stdout.sync = true
|
47
86
|
|
48
87
|
validate!
|
49
|
-
|
50
|
-
|
88
|
+
|
89
|
+
begin
|
51
90
|
response = connection.validate_template(create_validate_def)
|
52
91
|
rescue Excon::Errors::BadRequest => e
|
53
|
-
|
92
|
+
i= e.response.body.index("<Message>")
|
54
93
|
j = e.response.body.index("</Message>")
|
55
94
|
if !i.nil? and !j.nil?
|
56
95
|
ui.error(e.response.body[i+9,j-i-9])
|
@@ -61,20 +100,20 @@ class Chef
|
|
61
100
|
else
|
62
101
|
print "\n#{ui.color("Template validated successfully", :green)}"
|
63
102
|
end
|
64
|
-
end
|
65
|
-
|
103
|
+
end
|
104
|
+
|
66
105
|
def create_validate_def
|
67
|
-
validate_def = {}
|
106
|
+
validate_def = {}
|
68
107
|
template_file = locate_config_value(:template_file)
|
69
108
|
if template_file != nil and template_file != ""
|
70
109
|
doc = File.open(template_file, 'rb') { |file| file.read }
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
110
|
+
validate_def['TemplateBody'] = doc
|
111
|
+
else
|
112
|
+
validate_def['TemplateURL'] = locate_config_value(:template_url)
|
113
|
+
end
|
114
|
+
validate_def
|
76
115
|
end
|
77
|
-
|
116
|
+
|
78
117
|
end
|
79
118
|
end
|
80
119
|
end
|
data/lib/knife-cfn/version.rb
CHANGED
@@ -1,3 +1,3 @@
|
|
1
|
-
module KnifeCfn
|
2
|
-
VERSION = "0.1.10"
|
3
|
-
end
|
1
|
+
module KnifeCfn
|
2
|
+
VERSION = "0.1.10"
|
3
|
+
end
|
metadata
CHANGED
@@ -1,46 +1,41 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: knife-cfn
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
5
|
-
prerelease:
|
4
|
+
version: 0.1.11
|
6
5
|
platform: ruby
|
7
6
|
authors:
|
8
7
|
- Neill Turner
|
9
8
|
autorequire:
|
10
9
|
bindir: bin
|
11
10
|
cert_chain: []
|
12
|
-
date:
|
11
|
+
date: 2015-11-30 00:00:00.000000000 Z
|
13
12
|
dependencies:
|
14
13
|
- !ruby/object:Gem::Dependency
|
15
14
|
name: fog
|
16
15
|
requirement: !ruby/object:Gem::Requirement
|
17
|
-
none: false
|
18
16
|
requirements:
|
19
|
-
- -
|
17
|
+
- - "~>"
|
20
18
|
- !ruby/object:Gem::Version
|
21
|
-
version: '1.
|
19
|
+
version: '1.18'
|
22
20
|
type: :runtime
|
23
21
|
prerelease: false
|
24
22
|
version_requirements: !ruby/object:Gem::Requirement
|
25
|
-
none: false
|
26
23
|
requirements:
|
27
|
-
- -
|
24
|
+
- - "~>"
|
28
25
|
- !ruby/object:Gem::Version
|
29
|
-
version: '1.
|
26
|
+
version: '1.18'
|
30
27
|
- !ruby/object:Gem::Dependency
|
31
28
|
name: chef
|
32
29
|
requirement: !ruby/object:Gem::Requirement
|
33
|
-
none: false
|
34
30
|
requirements:
|
35
|
-
- -
|
31
|
+
- - ">="
|
36
32
|
- !ruby/object:Gem::Version
|
37
33
|
version: '11'
|
38
34
|
type: :runtime
|
39
35
|
prerelease: false
|
40
36
|
version_requirements: !ruby/object:Gem::Requirement
|
41
|
-
none: false
|
42
37
|
requirements:
|
43
|
-
- -
|
38
|
+
- - ">="
|
44
39
|
- !ruby/object:Gem::Version
|
45
40
|
version: '11'
|
46
41
|
description: CloudFormation Support for Chef's Knife Command
|
@@ -61,26 +56,25 @@ files:
|
|
61
56
|
- lib/knife-cfn/version.rb
|
62
57
|
homepage: https://github.com/neillturner/knife-cfn
|
63
58
|
licenses: []
|
59
|
+
metadata: {}
|
64
60
|
post_install_message:
|
65
61
|
rdoc_options: []
|
66
62
|
require_paths:
|
67
63
|
- lib
|
68
64
|
required_ruby_version: !ruby/object:Gem::Requirement
|
69
|
-
none: false
|
70
65
|
requirements:
|
71
|
-
- -
|
66
|
+
- - ">="
|
72
67
|
- !ruby/object:Gem::Version
|
73
68
|
version: '0'
|
74
69
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
75
|
-
none: false
|
76
70
|
requirements:
|
77
|
-
- -
|
71
|
+
- - ">="
|
78
72
|
- !ruby/object:Gem::Version
|
79
73
|
version: '0'
|
80
74
|
requirements: []
|
81
75
|
rubyforge_project:
|
82
|
-
rubygems_version:
|
76
|
+
rubygems_version: 2.2.2
|
83
77
|
signing_key:
|
84
|
-
specification_version:
|
78
|
+
specification_version: 4
|
85
79
|
summary: CloudFormation Support for Knife
|
86
80
|
test_files: []
|