knife-instance 0.1.0 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/lib/chef/knife/instance_create.rb +22 -11
- data/lib/knife-instance/version.rb +1 -1
- data/spec/lib/chef/knife/instance_create_spec.rb +15 -0
- metadata +19 -37
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 2d97bde36605b756b970380d6fa8779dd2a7e5c1
|
4
|
+
data.tar.gz: 757e14d913de4161d837762dbecd688e5e1c7743
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: f883a6c85ec53e9233642e2724d11cb88dca3606ae0be1f71ce9947972f98d5275dda14a39e676f07b3f71fc54f9fb9bec50aa57789e8d84259a2e21c745c8ef
|
7
|
+
data.tar.gz: 82b9ad60e49b3f56cae9cccf9cdf570f757c31c8a4562be942279ef98e97abf77531c3713e9a1539f4d3a7c25f3df658a2e940a4462b5ccfb7b317cf41b55501
|
@@ -40,11 +40,23 @@ class Chef
|
|
40
40
|
:long => "--groups X,Y,Z",
|
41
41
|
:description => "The security groups for this server"
|
42
42
|
|
43
|
+
option :security_group_ids,
|
44
|
+
:short => "-g X,Y,Z",
|
45
|
+
:long => "--security-group-ids X,Y,Z",
|
46
|
+
:description => "The security group ids for this server; required when using VPC",
|
47
|
+
:proc => Proc.new { |security_group_ids| security_group_ids.split(',') }
|
48
|
+
|
43
49
|
option :availability_zone,
|
44
50
|
:short => "-Z ZONE",
|
45
51
|
:long => "--availability-zone ZONE",
|
46
52
|
:description => "The Availability Zone"
|
47
53
|
|
54
|
+
option :subnet_id,
|
55
|
+
:short => "-s SUBNET-ID",
|
56
|
+
:long => "--subnet SUBNET-ID",
|
57
|
+
:description => "create node in this Virtual Private Cloud Subnet ID (implies VPC mode)",
|
58
|
+
:proc => Proc.new { |key| Chef::Config[:knife][:subnet_id] = key }
|
59
|
+
|
48
60
|
option :hostname,
|
49
61
|
:short => "-h NAME",
|
50
62
|
:long => "--node-name NAME",
|
@@ -141,21 +153,24 @@ class Chef
|
|
141
153
|
ic.config[:encrypted_data_bag_secret] = opts[:encrypted_data_bag_secret]
|
142
154
|
ic.config[:wait_for_it] = opts[:wait_for_it]
|
143
155
|
ic.config[:image] = opts[:image]
|
156
|
+
ic.config[:subnet_id] = opts[:subnet_id]
|
144
157
|
end
|
145
158
|
end
|
146
159
|
|
147
160
|
def create_server_def
|
148
161
|
server_def = {
|
149
|
-
:image_id
|
150
|
-
:groups
|
151
|
-
:
|
152
|
-
:
|
153
|
-
:
|
162
|
+
:image_id => image,
|
163
|
+
:groups => config[:security_groups],
|
164
|
+
:security_group_ids => config[:security_group_ids],
|
165
|
+
:flavor_id => config[:flavor],
|
166
|
+
:key_name => config[:aws_ssh_key_id],
|
167
|
+
:availability_zone => availability_zone,
|
168
|
+
:subnet_id => config[:subnet_id],
|
154
169
|
:tags => {
|
155
|
-
'Name'
|
170
|
+
'Name' => hostname,
|
156
171
|
'environment' => @environment
|
157
172
|
},
|
158
|
-
:user_data
|
173
|
+
:user_data => config[:without_user_data] ? "" : get_user_data,
|
159
174
|
:iam_instance_profile_name => config[:iam_role]
|
160
175
|
}
|
161
176
|
|
@@ -166,10 +181,6 @@ class Chef
|
|
166
181
|
config[:image]
|
167
182
|
end
|
168
183
|
|
169
|
-
def security_group
|
170
|
-
config[:security_groups]
|
171
|
-
end
|
172
|
-
|
173
184
|
def availability_zone
|
174
185
|
config[:availability_zone]
|
175
186
|
end
|
@@ -91,5 +91,20 @@ describe Chef::Knife::InstanceCreate do
|
|
91
91
|
end
|
92
92
|
end
|
93
93
|
end
|
94
|
+
|
95
|
+
describe "#create_server_def" do
|
96
|
+
context "VPC specific parameters" do
|
97
|
+
let(:subnet_id) { "subnet-123" }
|
98
|
+
let(:security_group_ids) { ['sg-123', 'sg456'] }
|
99
|
+
before do
|
100
|
+
@instance.config[:security_group_ids] = security_group_ids
|
101
|
+
@instance.config[:subnet_id] = subnet_id
|
102
|
+
end
|
103
|
+
|
104
|
+
subject { @instance.create_server_def }
|
105
|
+
its([:security_group_ids]) { should == security_group_ids }
|
106
|
+
its([:subnet_id]) { should == subnet_id }
|
107
|
+
end
|
108
|
+
end
|
94
109
|
end
|
95
110
|
end
|
metadata
CHANGED
@@ -1,8 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: knife-instance
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
5
|
-
prerelease:
|
4
|
+
version: 0.2.0
|
6
5
|
platform: ruby
|
7
6
|
authors:
|
8
7
|
- Alexander Tamoykin
|
@@ -10,86 +9,76 @@ authors:
|
|
10
9
|
autorequire:
|
11
10
|
bindir: bin
|
12
11
|
cert_chain: []
|
13
|
-
date:
|
12
|
+
date: 2014-01-27 00:00:00.000000000 Z
|
14
13
|
dependencies:
|
15
14
|
- !ruby/object:Gem::Dependency
|
16
15
|
name: chef
|
17
16
|
requirement: !ruby/object:Gem::Requirement
|
18
|
-
none: false
|
19
17
|
requirements:
|
20
|
-
- -
|
18
|
+
- - ">="
|
21
19
|
- !ruby/object:Gem::Version
|
22
20
|
version: 0.10.24
|
23
21
|
type: :runtime
|
24
22
|
prerelease: false
|
25
23
|
version_requirements: !ruby/object:Gem::Requirement
|
26
|
-
none: false
|
27
24
|
requirements:
|
28
|
-
- -
|
25
|
+
- - ">="
|
29
26
|
- !ruby/object:Gem::Version
|
30
27
|
version: 0.10.24
|
31
28
|
- !ruby/object:Gem::Dependency
|
32
29
|
name: fog
|
33
30
|
requirement: !ruby/object:Gem::Requirement
|
34
|
-
none: false
|
35
31
|
requirements:
|
36
|
-
- -
|
32
|
+
- - ">="
|
37
33
|
- !ruby/object:Gem::Version
|
38
34
|
version: 1.9.0
|
39
35
|
type: :runtime
|
40
36
|
prerelease: false
|
41
37
|
version_requirements: !ruby/object:Gem::Requirement
|
42
|
-
none: false
|
43
38
|
requirements:
|
44
|
-
- -
|
39
|
+
- - ">="
|
45
40
|
- !ruby/object:Gem::Version
|
46
41
|
version: 1.9.0
|
47
42
|
- !ruby/object:Gem::Dependency
|
48
43
|
name: rake
|
49
44
|
requirement: !ruby/object:Gem::Requirement
|
50
|
-
none: false
|
51
45
|
requirements:
|
52
|
-
- -
|
46
|
+
- - ">="
|
53
47
|
- !ruby/object:Gem::Version
|
54
48
|
version: '0'
|
55
49
|
type: :development
|
56
50
|
prerelease: false
|
57
51
|
version_requirements: !ruby/object:Gem::Requirement
|
58
|
-
none: false
|
59
52
|
requirements:
|
60
|
-
- -
|
53
|
+
- - ">="
|
61
54
|
- !ruby/object:Gem::Version
|
62
55
|
version: '0'
|
63
56
|
- !ruby/object:Gem::Dependency
|
64
57
|
name: rspec
|
65
58
|
requirement: !ruby/object:Gem::Requirement
|
66
|
-
none: false
|
67
59
|
requirements:
|
68
|
-
- -
|
60
|
+
- - ">="
|
69
61
|
- !ruby/object:Gem::Version
|
70
62
|
version: '0'
|
71
63
|
type: :development
|
72
64
|
prerelease: false
|
73
65
|
version_requirements: !ruby/object:Gem::Requirement
|
74
|
-
none: false
|
75
66
|
requirements:
|
76
|
-
- -
|
67
|
+
- - ">="
|
77
68
|
- !ruby/object:Gem::Version
|
78
69
|
version: '0'
|
79
70
|
- !ruby/object:Gem::Dependency
|
80
71
|
name: require_all
|
81
72
|
requirement: !ruby/object:Gem::Requirement
|
82
|
-
none: false
|
83
73
|
requirements:
|
84
|
-
- -
|
74
|
+
- - ">="
|
85
75
|
- !ruby/object:Gem::Version
|
86
76
|
version: '0'
|
87
77
|
type: :development
|
88
78
|
prerelease: false
|
89
79
|
version_requirements: !ruby/object:Gem::Requirement
|
90
|
-
none: false
|
91
80
|
requirements:
|
92
|
-
- -
|
81
|
+
- - ">="
|
93
82
|
- !ruby/object:Gem::Version
|
94
83
|
version: '0'
|
95
84
|
description: Manage EC2 instances with Chef from the command line
|
@@ -100,8 +89,8 @@ executables: []
|
|
100
89
|
extensions: []
|
101
90
|
extra_rdoc_files: []
|
102
91
|
files:
|
103
|
-
- .gitignore
|
104
|
-
- .travis.yml
|
92
|
+
- ".gitignore"
|
93
|
+
- ".travis.yml"
|
105
94
|
- Gemfile
|
106
95
|
- LICENSE
|
107
96
|
- README.md
|
@@ -121,33 +110,26 @@ files:
|
|
121
110
|
homepage: https://github.com/ZestFinance/knife-instance
|
122
111
|
licenses:
|
123
112
|
- MIT
|
113
|
+
metadata: {}
|
124
114
|
post_install_message:
|
125
115
|
rdoc_options: []
|
126
116
|
require_paths:
|
127
117
|
- lib
|
128
118
|
required_ruby_version: !ruby/object:Gem::Requirement
|
129
|
-
none: false
|
130
119
|
requirements:
|
131
|
-
- -
|
120
|
+
- - ">="
|
132
121
|
- !ruby/object:Gem::Version
|
133
122
|
version: '0'
|
134
|
-
segments:
|
135
|
-
- 0
|
136
|
-
hash: -3631599552630895710
|
137
123
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
138
|
-
none: false
|
139
124
|
requirements:
|
140
|
-
- -
|
125
|
+
- - ">="
|
141
126
|
- !ruby/object:Gem::Version
|
142
127
|
version: '0'
|
143
|
-
segments:
|
144
|
-
- 0
|
145
|
-
hash: -3631599552630895710
|
146
128
|
requirements: []
|
147
129
|
rubyforge_project:
|
148
|
-
rubygems_version:
|
130
|
+
rubygems_version: 2.2.0
|
149
131
|
signing_key:
|
150
|
-
specification_version:
|
132
|
+
specification_version: 4
|
151
133
|
summary: Manage EC2 instances with Chef from the command line
|
152
134
|
test_files:
|
153
135
|
- spec/lib/chef/knife/instance_create_spec.rb
|