knife-cloud 1.2.1 → 1.2.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/LICENSE +1 -1
- data/lib/chef/knife/cloud/chefbootstrap/bootstrap_distribution.rb +2 -2
- data/lib/chef/knife/cloud/chefbootstrap/bootstrap_options.rb +115 -133
- data/lib/chef/knife/cloud/chefbootstrap/bootstrap_protocol.rb +6 -6
- data/lib/chef/knife/cloud/chefbootstrap/bootstrapper.rb +11 -12
- data/lib/chef/knife/cloud/chefbootstrap/ssh_bootstrap_protocol.rb +49 -54
- data/lib/chef/knife/cloud/chefbootstrap/unix_distribution.rb +3 -3
- data/lib/chef/knife/cloud/chefbootstrap/windows_distribution.rb +3 -3
- data/lib/chef/knife/cloud/chefbootstrap/winrm_bootstrap_protocol.rb +11 -12
- data/lib/chef/knife/cloud/command.rb +24 -27
- data/lib/chef/knife/cloud/exceptions.rb +1 -2
- data/lib/chef/knife/cloud/fog/options.rb +8 -8
- data/lib/chef/knife/cloud/fog/service.rb +54 -60
- data/lib/chef/knife/cloud/helpers.rb +2 -3
- data/lib/chef/knife/cloud/list_resource_command.rb +6 -7
- data/lib/chef/knife/cloud/list_resource_options.rb +5 -5
- data/lib/chef/knife/cloud/server/create_command.rb +30 -35
- data/lib/chef/knife/cloud/server/create_options.rb +33 -34
- data/lib/chef/knife/cloud/server/delete_command.rb +12 -15
- data/lib/chef/knife/cloud/server/delete_options.rb +7 -8
- data/lib/chef/knife/cloud/server/list_command.rb +22 -22
- data/lib/chef/knife/cloud/server/list_options.rb +9 -10
- data/lib/chef/knife/cloud/server/options.rb +7 -7
- data/lib/chef/knife/cloud/server/show_command.rb +5 -5
- data/lib/chef/knife/cloud/server/show_options.rb +5 -6
- data/lib/chef/knife/cloud/service.rb +12 -13
- data/lib/knife-cloud/version.rb +2 -2
- data/lib/test/fixtures/knife.rb +3 -3
- data/lib/test/fixtures/validation.pem +27 -0
- data/lib/test/knife-utils/helper.rb +11 -11
- data/lib/test/knife-utils/knife_test_utils.rb +4 -4
- data/lib/test/knife-utils/matchers.rb +3 -3
- data/lib/test/knife-utils/test_bed.rb +38 -38
- data/lib/test/templates/windows-chef-client-msi.erb +3 -4
- data/lib/test/templates/windows-shell.erb +2 -2
- metadata +12 -152
- data/.gitignore +0 -33
- data/.travis.yml +0 -6
- data/CHANGELOG.md +0 -133
- data/CONTRIBUTING.md +0 -5
- data/Gemfile +0 -9
- data/README.md +0 -421
- data/Rakefile +0 -35
- data/ci.gemfile +0 -18
- data/knife-cloud.gemspec +0 -26
- data/spec/resource_spec_helper.rb +0 -49
- data/spec/server_command_common_spec_helper.rb +0 -48
- data/spec/spec_helper.rb +0 -25
- data/spec/support/shared_examples_for_command.rb +0 -35
- data/spec/support/shared_examples_for_servercreatecommand.rb +0 -144
- data/spec/support/shared_examples_for_serverdeletecommand.rb +0 -77
- data/spec/support/shared_examples_for_service.rb +0 -85
- data/spec/unit/bootstrap_protocol_spec.rb +0 -98
- data/spec/unit/bootstrapper_spec.rb +0 -171
- data/spec/unit/cloud_command_spec.rb +0 -35
- data/spec/unit/command_spec.rb +0 -49
- data/spec/unit/fog_service_spec.rb +0 -163
- data/spec/unit/list_resource_command_spec.rb +0 -140
- data/spec/unit/server_create_command_spec.rb +0 -198
- data/spec/unit/server_delete_command_spec.rb +0 -25
- data/spec/unit/server_list_command_spec.rb +0 -119
- data/spec/unit/server_show_command_spec.rb +0 -64
- data/spec/unit/service_spec.rb +0 -46
- data/spec/unit/ssh_bootstrap_protocol_spec.rb +0 -116
- data/spec/unit/unix_distribution_spec.rb +0 -37
- data/spec/unit/windows_distribution_spec.rb +0 -37
- data/spec/unit/winrm_bootstrap_protocol_spec.rb +0 -108
@@ -1,6 +1,6 @@
|
|
1
1
|
@rem
|
2
|
-
@rem Author:: Seth Chisamore (<schisamo@
|
3
|
-
@rem Copyright:: Copyright (c) 2011
|
2
|
+
@rem Author:: Seth Chisamore (<schisamo@chef.io>)
|
3
|
+
@rem Copyright:: Copyright (c) 2011-2016 Chef Software, Inc.
|
4
4
|
@rem License:: Apache License, Version 2.0
|
5
5
|
@rem
|
6
6
|
@rem Licensed under the Apache License, Version 2.0 (the "License");
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: knife-cloud
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.2.
|
4
|
+
version: 1.2.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Kaustubh Deorukhkar
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2018-11-28 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: knife-windows
|
@@ -17,28 +17,14 @@ dependencies:
|
|
17
17
|
requirements:
|
18
18
|
- - ">="
|
19
19
|
- !ruby/object:Gem::Version
|
20
|
-
version: 0
|
20
|
+
version: '1.0'
|
21
21
|
type: :runtime
|
22
22
|
prerelease: false
|
23
23
|
version_requirements: !ruby/object:Gem::Requirement
|
24
24
|
requirements:
|
25
25
|
- - ">="
|
26
26
|
- !ruby/object:Gem::Version
|
27
|
-
version: 0
|
28
|
-
- !ruby/object:Gem::Dependency
|
29
|
-
name: chef
|
30
|
-
requirement: !ruby/object:Gem::Requirement
|
31
|
-
requirements:
|
32
|
-
- - ">="
|
33
|
-
- !ruby/object:Gem::Version
|
34
|
-
version: 0.10.10
|
35
|
-
type: :runtime
|
36
|
-
prerelease: false
|
37
|
-
version_requirements: !ruby/object:Gem::Requirement
|
38
|
-
requirements:
|
39
|
-
- - ">="
|
40
|
-
- !ruby/object:Gem::Version
|
41
|
-
version: 0.10.10
|
27
|
+
version: '1.0'
|
42
28
|
- !ruby/object:Gem::Dependency
|
43
29
|
name: mixlib-shellout
|
44
30
|
requirement: !ruby/object:Gem::Requirement
|
@@ -54,108 +40,27 @@ dependencies:
|
|
54
40
|
- !ruby/object:Gem::Version
|
55
41
|
version: '0'
|
56
42
|
- !ruby/object:Gem::Dependency
|
57
|
-
name:
|
58
|
-
requirement: !ruby/object:Gem::Requirement
|
59
|
-
requirements:
|
60
|
-
- - ">="
|
61
|
-
- !ruby/object:Gem::Version
|
62
|
-
version: '0'
|
63
|
-
type: :development
|
64
|
-
prerelease: false
|
65
|
-
version_requirements: !ruby/object:Gem::Requirement
|
66
|
-
requirements:
|
67
|
-
- - ">="
|
68
|
-
- !ruby/object:Gem::Version
|
69
|
-
version: '0'
|
70
|
-
- !ruby/object:Gem::Dependency
|
71
|
-
name: rspec-expectations
|
72
|
-
requirement: !ruby/object:Gem::Requirement
|
73
|
-
requirements:
|
74
|
-
- - ">="
|
75
|
-
- !ruby/object:Gem::Version
|
76
|
-
version: '0'
|
77
|
-
type: :development
|
78
|
-
prerelease: false
|
79
|
-
version_requirements: !ruby/object:Gem::Requirement
|
80
|
-
requirements:
|
81
|
-
- - ">="
|
82
|
-
- !ruby/object:Gem::Version
|
83
|
-
version: '0'
|
84
|
-
- !ruby/object:Gem::Dependency
|
85
|
-
name: rspec-mocks
|
86
|
-
requirement: !ruby/object:Gem::Requirement
|
87
|
-
requirements:
|
88
|
-
- - ">="
|
89
|
-
- !ruby/object:Gem::Version
|
90
|
-
version: '0'
|
91
|
-
type: :development
|
92
|
-
prerelease: false
|
93
|
-
version_requirements: !ruby/object:Gem::Requirement
|
94
|
-
requirements:
|
95
|
-
- - ">="
|
96
|
-
- !ruby/object:Gem::Version
|
97
|
-
version: '0'
|
98
|
-
- !ruby/object:Gem::Dependency
|
99
|
-
name: rspec_junit_formatter
|
100
|
-
requirement: !ruby/object:Gem::Requirement
|
101
|
-
requirements:
|
102
|
-
- - ">="
|
103
|
-
- !ruby/object:Gem::Version
|
104
|
-
version: '0'
|
105
|
-
type: :development
|
106
|
-
prerelease: false
|
107
|
-
version_requirements: !ruby/object:Gem::Requirement
|
108
|
-
requirements:
|
109
|
-
- - ">="
|
110
|
-
- !ruby/object:Gem::Version
|
111
|
-
version: '0'
|
112
|
-
- !ruby/object:Gem::Dependency
|
113
|
-
name: fog
|
43
|
+
name: excon
|
114
44
|
requirement: !ruby/object:Gem::Requirement
|
115
45
|
requirements:
|
116
46
|
- - ">="
|
117
47
|
- !ruby/object:Gem::Version
|
118
|
-
version: '0'
|
119
|
-
type: :
|
120
|
-
prerelease: false
|
121
|
-
version_requirements: !ruby/object:Gem::Requirement
|
122
|
-
requirements:
|
123
|
-
- - ">="
|
124
|
-
- !ruby/object:Gem::Version
|
125
|
-
version: '0'
|
126
|
-
- !ruby/object:Gem::Dependency
|
127
|
-
name: rubocop
|
128
|
-
requirement: !ruby/object:Gem::Requirement
|
129
|
-
requirements:
|
130
|
-
- - ">="
|
131
|
-
- !ruby/object:Gem::Version
|
132
|
-
version: '0'
|
133
|
-
type: :development
|
48
|
+
version: '0.50'
|
49
|
+
type: :runtime
|
134
50
|
prerelease: false
|
135
51
|
version_requirements: !ruby/object:Gem::Requirement
|
136
52
|
requirements:
|
137
53
|
- - ">="
|
138
54
|
- !ruby/object:Gem::Version
|
139
|
-
version: '0'
|
55
|
+
version: '0.50'
|
140
56
|
description: knife-cloud plugin
|
141
57
|
email:
|
142
58
|
- dev@chef.io
|
143
59
|
executables: []
|
144
60
|
extensions: []
|
145
|
-
extra_rdoc_files:
|
146
|
-
- README.md
|
147
|
-
- LICENSE
|
61
|
+
extra_rdoc_files: []
|
148
62
|
files:
|
149
|
-
- ".gitignore"
|
150
|
-
- ".travis.yml"
|
151
|
-
- CHANGELOG.md
|
152
|
-
- CONTRIBUTING.md
|
153
|
-
- Gemfile
|
154
63
|
- LICENSE
|
155
|
-
- README.md
|
156
|
-
- Rakefile
|
157
|
-
- ci.gemfile
|
158
|
-
- knife-cloud.gemspec
|
159
64
|
- lib/chef/knife/cloud/chefbootstrap/bootstrap_distribution.rb
|
160
65
|
- lib/chef/knife/cloud/chefbootstrap/bootstrap_options.rb
|
161
66
|
- lib/chef/knife/cloud/chefbootstrap/bootstrap_protocol.rb
|
@@ -191,28 +96,6 @@ files:
|
|
191
96
|
- lib/test/templates/chef-full-chef-zero.erb
|
192
97
|
- lib/test/templates/windows-chef-client-msi.erb
|
193
98
|
- lib/test/templates/windows-shell.erb
|
194
|
-
- spec/resource_spec_helper.rb
|
195
|
-
- spec/server_command_common_spec_helper.rb
|
196
|
-
- spec/spec_helper.rb
|
197
|
-
- spec/support/shared_examples_for_command.rb
|
198
|
-
- spec/support/shared_examples_for_servercreatecommand.rb
|
199
|
-
- spec/support/shared_examples_for_serverdeletecommand.rb
|
200
|
-
- spec/support/shared_examples_for_service.rb
|
201
|
-
- spec/unit/bootstrap_protocol_spec.rb
|
202
|
-
- spec/unit/bootstrapper_spec.rb
|
203
|
-
- spec/unit/cloud_command_spec.rb
|
204
|
-
- spec/unit/command_spec.rb
|
205
|
-
- spec/unit/fog_service_spec.rb
|
206
|
-
- spec/unit/list_resource_command_spec.rb
|
207
|
-
- spec/unit/server_create_command_spec.rb
|
208
|
-
- spec/unit/server_delete_command_spec.rb
|
209
|
-
- spec/unit/server_list_command_spec.rb
|
210
|
-
- spec/unit/server_show_command_spec.rb
|
211
|
-
- spec/unit/service_spec.rb
|
212
|
-
- spec/unit/ssh_bootstrap_protocol_spec.rb
|
213
|
-
- spec/unit/unix_distribution_spec.rb
|
214
|
-
- spec/unit/windows_distribution_spec.rb
|
215
|
-
- spec/unit/winrm_bootstrap_protocol_spec.rb
|
216
99
|
homepage: https://github.com/chef/knife-cloud
|
217
100
|
licenses: []
|
218
101
|
metadata: {}
|
@@ -220,12 +103,11 @@ post_install_message:
|
|
220
103
|
rdoc_options: []
|
221
104
|
require_paths:
|
222
105
|
- lib
|
223
|
-
- spec
|
224
106
|
required_ruby_version: !ruby/object:Gem::Requirement
|
225
107
|
requirements:
|
226
108
|
- - ">="
|
227
109
|
- !ruby/object:Gem::Version
|
228
|
-
version:
|
110
|
+
version: 2.2.2
|
229
111
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
230
112
|
requirements:
|
231
113
|
- - ">="
|
@@ -233,30 +115,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
233
115
|
version: '0'
|
234
116
|
requirements: []
|
235
117
|
rubyforge_project:
|
236
|
-
rubygems_version: 2.
|
118
|
+
rubygems_version: 2.7.6
|
237
119
|
signing_key:
|
238
120
|
specification_version: 4
|
239
121
|
summary: knife-cloud plugin
|
240
|
-
test_files:
|
241
|
-
- spec/resource_spec_helper.rb
|
242
|
-
- spec/server_command_common_spec_helper.rb
|
243
|
-
- spec/spec_helper.rb
|
244
|
-
- spec/support/shared_examples_for_command.rb
|
245
|
-
- spec/support/shared_examples_for_servercreatecommand.rb
|
246
|
-
- spec/support/shared_examples_for_serverdeletecommand.rb
|
247
|
-
- spec/support/shared_examples_for_service.rb
|
248
|
-
- spec/unit/bootstrap_protocol_spec.rb
|
249
|
-
- spec/unit/bootstrapper_spec.rb
|
250
|
-
- spec/unit/cloud_command_spec.rb
|
251
|
-
- spec/unit/command_spec.rb
|
252
|
-
- spec/unit/fog_service_spec.rb
|
253
|
-
- spec/unit/list_resource_command_spec.rb
|
254
|
-
- spec/unit/server_create_command_spec.rb
|
255
|
-
- spec/unit/server_delete_command_spec.rb
|
256
|
-
- spec/unit/server_list_command_spec.rb
|
257
|
-
- spec/unit/server_show_command_spec.rb
|
258
|
-
- spec/unit/service_spec.rb
|
259
|
-
- spec/unit/ssh_bootstrap_protocol_spec.rb
|
260
|
-
- spec/unit/unix_distribution_spec.rb
|
261
|
-
- spec/unit/windows_distribution_spec.rb
|
262
|
-
- spec/unit/winrm_bootstrap_protocol_spec.rb
|
122
|
+
test_files: []
|
data/.gitignore
DELETED
@@ -1,33 +0,0 @@
|
|
1
|
-
.autotest
|
2
|
-
coverage
|
3
|
-
.DS_Store
|
4
|
-
pkg
|
5
|
-
*/tags
|
6
|
-
*~
|
7
|
-
|
8
|
-
# you should check in your Gemfile.lock in applications, and not in gems
|
9
|
-
Gemfile.lock
|
10
|
-
Gemfile.local
|
11
|
-
|
12
|
-
# Do not check in the .bundle directory, or any of the files inside it. Those files are specific to each particular machine, and are used to persist installation options between runs of the bundle install command.
|
13
|
-
.bundle
|
14
|
-
|
15
|
-
# ignore some common Bundler 'binstubs' directory names
|
16
|
-
# http://gembundler.com/man/bundle-exec.1.html
|
17
|
-
b/
|
18
|
-
binstubs/
|
19
|
-
|
20
|
-
# RVM and RBENV ruby version files
|
21
|
-
.rbenv-version
|
22
|
-
.rvmrc
|
23
|
-
|
24
|
-
# Documentation
|
25
|
-
_site/*
|
26
|
-
.yardoc/
|
27
|
-
doc/
|
28
|
-
|
29
|
-
*.gem
|
30
|
-
pkg/*
|
31
|
-
|
32
|
-
#keys
|
33
|
-
*.pem
|
data/.travis.yml
DELETED
data/CHANGELOG.md
DELETED
@@ -1,133 +0,0 @@
|
|
1
|
-
# Change Log
|
2
|
-
|
3
|
-
## [v1.2.1](https://github.com/chef/knife-cloud/tree/v1.2.1) (2016-02-24)
|
4
|
-
|
5
|
-
[Full Changelog](https://github.com/chef/knife-cloud/compare/v1.2.0...v1.2.1)
|
6
|
-
|
7
|
-
**Merged pull requests:**
|
8
|
-
|
9
|
-
- Passing bootstrap\_ip\_address as an array object instead of string [\#101](https://github.com/chef/knife-cloud/pull/101) ([NimishaS](https://github.com/NimishaS))
|
10
|
-
- Added new knife windows options [\#98](https://github.com/chef/knife-cloud/pull/98) ([siddheshwar-more](https://github.com/siddheshwar-more))
|
11
|
-
|
12
|
-
## [v1.2.0](https://github.com/chef/knife-cloud/tree/v1.2.0) (2015-07-18)
|
13
|
-
[Full Changelog](https://github.com/chef/knife-cloud/compare/v1.2.0.rc.0...v1.2.0)
|
14
|
-
|
15
|
-
**Closed issues:**
|
16
|
-
|
17
|
-
- both -F json ad --format json does not work [\#91](https://github.com/chef/knife-cloud/issues/91)
|
18
|
-
|
19
|
-
**Merged pull requests:**
|
20
|
-
|
21
|
-
- Adding support for floating ip commands [\#96](https://github.com/chef/knife-cloud/pull/96) ([Vasu1105](https://github.com/Vasu1105))
|
22
|
-
|
23
|
-
## [v1.2.0.rc.0](https://github.com/chef/knife-cloud/tree/v1.2.0.rc.0) (2015-06-25)
|
24
|
-
[Full Changelog](https://github.com/chef/knife-cloud/compare/v1.1.0...v1.2.0.rc.0)
|
25
|
-
|
26
|
-
**Merged pull requests:**
|
27
|
-
|
28
|
-
- Show result in the format provided by user in -F or --format option [\#93](https://github.com/chef/knife-cloud/pull/93) ([NimishaS](https://github.com/NimishaS))
|
29
|
-
|
30
|
-
## [v1.1.0](https://github.com/chef/knife-cloud/tree/v1.1.0) (2015-06-18)
|
31
|
-
[Full Changelog](https://github.com/chef/knife-cloud/compare/v1.1.0.rc.0...v1.1.0)
|
32
|
-
|
33
|
-
**Merged pull requests:**
|
34
|
-
|
35
|
-
- bumped the version for a full release [\#92](https://github.com/chef/knife-cloud/pull/92) ([jjasghar](https://github.com/jjasghar))
|
36
|
-
|
37
|
-
## [v1.1.0.rc.0](https://github.com/chef/knife-cloud/tree/v1.1.0.rc.0) (2015-06-10)
|
38
|
-
[Full Changelog](https://github.com/chef/knife-cloud/compare/1.0.1...v1.1.0.rc.0)
|
39
|
-
|
40
|
-
**Closed issues:**
|
41
|
-
|
42
|
-
- Unable to create server w/ v1.0 [\#82](https://github.com/chef/knife-cloud/issues/82)
|
43
|
-
|
44
|
-
**Merged pull requests:**
|
45
|
-
|
46
|
-
- Updated an RC version [\#90](https://github.com/chef/knife-cloud/pull/90) ([jjasghar](https://github.com/jjasghar))
|
47
|
-
- Updated the readme [\#89](https://github.com/chef/knife-cloud/pull/89) ([jjasghar](https://github.com/jjasghar))
|
48
|
-
- the chef\_version is broken [\#88](https://github.com/chef/knife-cloud/pull/88) ([jjasghar](https://github.com/jjasghar))
|
49
|
-
- Looks like you doubled up some code [\#87](https://github.com/chef/knife-cloud/pull/87) ([jjasghar](https://github.com/jjasghar))
|
50
|
-
- Update knife-cloud to have all the new bootstrap options of Chef 12 [\#85](https://github.com/chef/knife-cloud/pull/85) ([NimishaS](https://github.com/NimishaS))
|
51
|
-
- remove 'em-winrm' gem dependency [\#83](https://github.com/chef/knife-cloud/pull/83) ([prabhu-das](https://github.com/prabhu-das))
|
52
|
-
|
53
|
-
## [1.0.1](https://github.com/chef/knife-cloud/tree/1.0.1) (2014-09-19)
|
54
|
-
[Full Changelog](https://github.com/chef/knife-cloud/compare/1.0.0...1.0.1)
|
55
|
-
|
56
|
-
**Closed issues:**
|
57
|
-
|
58
|
-
- floating-ips seem to throw an error with knife-openstack [\#78](https://github.com/chef/knife-cloud/issues/78)
|
59
|
-
- -i and -x no longer work with ssh [\#74](https://github.com/chef/knife-cloud/issues/74)
|
60
|
-
|
61
|
-
**Merged pull requests:**
|
62
|
-
|
63
|
-
- Limit hostnames to 15 characters \(for windows\) [\#81](https://github.com/chef/knife-cloud/pull/81) ([hh](https://github.com/hh))
|
64
|
-
|
65
|
-
## [1.0.0](https://github.com/chef/knife-cloud/tree/1.0.0) (2014-08-11)
|
66
|
-
[Full Changelog](https://github.com/chef/knife-cloud/compare/1.0.0.rc.0...1.0.0)
|
67
|
-
|
68
|
-
**Merged pull requests:**
|
69
|
-
|
70
|
-
- Release knife-cloud 1.0.0 [\#80](https://github.com/chef/knife-cloud/pull/80) ([adamedx](https://github.com/adamedx))
|
71
|
-
- \[knife-cloud\] Change Fog to dev dependency [\#79](https://github.com/chef/knife-cloud/pull/79) ([siddheshwar-more](https://github.com/siddheshwar-more))
|
72
|
-
|
73
|
-
## [1.0.0.rc.0](https://github.com/chef/knife-cloud/tree/1.0.0.rc.0) (2014-07-27)
|
74
|
-
**Closed issues:**
|
75
|
-
|
76
|
-
- -a for floating IPs is broken with knife-openstack [\#76](https://github.com/chef/knife-cloud/issues/76)
|
77
|
-
|
78
|
-
**Merged pull requests:**
|
79
|
-
|
80
|
-
- Release candidate knife-cloud 1.0.0.rc.0 [\#77](https://github.com/chef/knife-cloud/pull/77) ([adamedx](https://github.com/adamedx))
|
81
|
-
- \[knife-cloud\] Common short options in ssh & winrm \(SSH override winrm config\) [\#75](https://github.com/chef/knife-cloud/pull/75) ([siddheshwar-more](https://github.com/siddheshwar-more))
|
82
|
-
- \[knife-cloud\] Add missing bootstrap options to knife-cloud [\#73](https://github.com/chef/knife-cloud/pull/73) ([siddheshwar-more](https://github.com/siddheshwar-more))
|
83
|
-
- Added changes for template-file option [\#72](https://github.com/chef/knife-cloud/pull/72) ([kaustubh-d](https://github.com/kaustubh-d))
|
84
|
-
- knife-ec2 master to knife-ec2 knife-cloud sync [\#71](https://github.com/chef/knife-cloud/pull/71) ([prabhu-das](https://github.com/prabhu-das))
|
85
|
-
- Specify name or id for image and flavor in server create [\#70](https://github.com/chef/knife-cloud/pull/70) ([kaustubh-d](https://github.com/kaustubh-d))
|
86
|
-
- \[knife-cloud\] Fixes for rspec deprecated warnings [\#69](https://github.com/chef/knife-cloud/pull/69) ([siddheshwar-more](https://github.com/siddheshwar-more))
|
87
|
-
- Sorting list outputs by sort\_by\_field with case insensitive sort. [\#68](https://github.com/chef/knife-cloud/pull/68) ([prabhu-das](https://github.com/prabhu-das))
|
88
|
-
- \[knife-cloud\] KNIFE-477: Delete server by name if instance\_id isn't found [\#67](https://github.com/chef/knife-cloud/pull/67) ([ameyavarade](https://github.com/ameyavarade))
|
89
|
-
- Changes for enabling network list [\#66](https://github.com/chef/knife-cloud/pull/66) ([prabhu-das](https://github.com/prabhu-das))
|
90
|
-
- Refactored redundant code. [\#65](https://github.com/chef/knife-cloud/pull/65) ([ameyavarade](https://github.com/ameyavarade))
|
91
|
-
- Fixed code and spec for Excon error [\#64](https://github.com/chef/knife-cloud/pull/64) ([prabhu-das](https://github.com/prabhu-das))
|
92
|
-
- Remove extraneous use of active-support for the better good [\#63](https://github.com/chef/knife-cloud/pull/63) ([btm](https://github.com/btm))
|
93
|
-
- Rebase integration tests [\#61](https://github.com/chef/knife-cloud/pull/61) ([muktaa](https://github.com/muktaa))
|
94
|
-
- OC-10611 implementation for custom\_arguments passed to Fog [\#57](https://github.com/chef/knife-cloud/pull/57) ([prabhu-das](https://github.com/prabhu-das))
|
95
|
-
- Updated test windows template to latest knife windows \( -V 0.5.14\) template. [\#56](https://github.com/chef/knife-cloud/pull/56) ([siddheshwar-more](https://github.com/siddheshwar-more))
|
96
|
-
- OC-11210 EC2 refactored code has ambiguity in the name of short-option for Gateway & Groups [\#54](https://github.com/chef/knife-cloud/pull/54) ([siddheshwar-more](https://github.com/siddheshwar-more))
|
97
|
-
- OC-11204 - Exception handling and abstraction [\#53](https://github.com/chef/knife-cloud/pull/53) ([kaustubh-d](https://github.com/kaustubh-d))
|
98
|
-
- OC-11140 nested values support [\#51](https://github.com/chef/knife-cloud/pull/51) ([prabhu-das](https://github.com/prabhu-das))
|
99
|
-
- OC-10823 knife-ec2 server create and bootstrap windows instance using ssh [\#48](https://github.com/chef/knife-cloud/pull/48) ([siddheshwar-more](https://github.com/siddheshwar-more))
|
100
|
-
- Handle fog errors in knife-cloud [\#47](https://github.com/chef/knife-cloud/pull/47) ([siddheshwar-more](https://github.com/siddheshwar-more))
|
101
|
-
- Updated code to reflect server name for both openstack and ec2 when --ch... [\#46](https://github.com/chef/knife-cloud/pull/46) ([prabhu-das](https://github.com/prabhu-das))
|
102
|
-
- OC-10520 knife-cloud should add data summary methods [\#43](https://github.com/chef/knife-cloud/pull/43) ([ameyavarade](https://github.com/ameyavarade))
|
103
|
-
- OC-9950 Support common options of knife bootstrap in knife cloud [\#42](https://github.com/chef/knife-cloud/pull/42) ([siddheshwar-more](https://github.com/siddheshwar-more))
|
104
|
-
- OC-9596: Succesfully run the integration tests on jenkins for knife-openstack\(based on knife-cloud\) [\#41](https://github.com/chef/knife-cloud/pull/41) ([adamedx](https://github.com/adamedx))
|
105
|
-
- OC-9430: Knife cloud should support endpoint config and cli option [\#40](https://github.com/chef/knife-cloud/pull/40) ([adamedx](https://github.com/adamedx))
|
106
|
-
- Let knife-windows find the template based on distro supplied. [\#38](https://github.com/chef/knife-cloud/pull/38) ([chirag-jog](https://github.com/chirag-jog))
|
107
|
-
- Updated rspec tests for server list, create command [\#36](https://github.com/chef/knife-cloud/pull/36) ([adamedx](https://github.com/adamedx))
|
108
|
-
- Updated rspec tests for server list, create command [\#35](https://github.com/chef/knife-cloud/pull/35) ([siddheshwar-more](https://github.com/siddheshwar-more))
|
109
|
-
- OC-9613: os\_image\_type should be inferred from bootstrap protocol if not specified to knife cloud [\#34](https://github.com/chef/knife-cloud/pull/34) ([adamedx](https://github.com/adamedx))
|
110
|
-
- OC-9533 knife CLOUD server list needs to expose Chef data \(node names, attributes\) [\#33](https://github.com/chef/knife-cloud/pull/33) ([siddheshwar-more](https://github.com/siddheshwar-more))
|
111
|
-
- OC-9207: OC-9390: Dynamic Fog gem versioning, Exit code handling [\#31](https://github.com/chef/knife-cloud/pull/31) ([adamedx](https://github.com/adamedx))
|
112
|
-
- OC 9450 - Auto generate chef node name when not input by user [\#30](https://github.com/chef/knife-cloud/pull/30) ([muktaa](https://github.com/muktaa))
|
113
|
-
- OC-8965: Provide CLI option to delete server on bootstrap failure [\#28](https://github.com/chef/knife-cloud/pull/28) ([adamedx](https://github.com/adamedx))
|
114
|
-
- OC-9368 Image\_os\_type option should be compulsory in knife-openstack. [\#26](https://github.com/chef/knife-cloud/pull/26) ([siddheshwar-more](https://github.com/siddheshwar-more))
|
115
|
-
- Sprint 86: Merge Gem dependencies, Travis support [\#24](https://github.com/chef/knife-cloud/pull/24) ([adamedx](https://github.com/adamedx))
|
116
|
-
- oc 8965 delete server when bootstrap fails [\#23](https://github.com/chef/knife-cloud/pull/23) ([muktaa](https://github.com/muktaa))
|
117
|
-
- 9107 knife cloud travis [\#22](https://github.com/chef/knife-cloud/pull/22) ([muktaa](https://github.com/muktaa))
|
118
|
-
- Windows bootstrap support + correct gem dependency for knife-windows [\#20](https://github.com/chef/knife-cloud/pull/20) ([muktaa](https://github.com/muktaa))
|
119
|
-
- Windows bootstrap support + correct gem dependency for knife-windows [\#18](https://github.com/chef/knife-cloud/pull/18) ([muktaa](https://github.com/muktaa))
|
120
|
-
- OC-8572: Knife cloud openstack create with bootstrap Windows [\#16](https://github.com/chef/knife-cloud/pull/16) ([adamedx](https://github.com/adamedx))
|
121
|
-
- OC-8822: Knife cloud openstack server list command [\#15](https://github.com/chef/knife-cloud/pull/15) ([adamedx](https://github.com/adamedx))
|
122
|
-
- Resource Listing changes \(OC 8822, 8824, 8825, 8826\) [\#13](https://github.com/chef/knife-cloud/pull/13) ([muktaa](https://github.com/muktaa))
|
123
|
-
- Add notices to sources [\#12](https://github.com/chef/knife-cloud/pull/12) ([adamedx](https://github.com/adamedx))
|
124
|
-
- First working version of knife-cloud \(merged and rebased\) [\#10](https://github.com/chef/knife-cloud/pull/10) ([chirag-jog](https://github.com/chirag-jog))
|
125
|
-
- Knife cloud plugin [\#9](https://github.com/chef/knife-cloud/pull/9) ([muktaa](https://github.com/muktaa))
|
126
|
-
- OC-8310: Base framework library for knife plug-in tests [\#8](https://github.com/chef/knife-cloud/pull/8) ([adamedx](https://github.com/adamedx))
|
127
|
-
- OC-8427: OC-8426: OC-8425: OC-8428: Unit tests for knife-cloud [\#7](https://github.com/chef/knife-cloud/pull/7) ([adamedx](https://github.com/adamedx))
|
128
|
-
- OC-8312: Knife-cloud gem skeleton [\#6](https://github.com/chef/knife-cloud/pull/6) ([adamedx](https://github.com/adamedx))
|
129
|
-
- OC-8312 Knife-cloud gem skeleton [\#3](https://github.com/chef/knife-cloud/pull/3) ([kaustubh-d](https://github.com/kaustubh-d))
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
\* *This Change Log was automatically generated by [github_changelog_generator](https://github.com/skywinder/Github-Changelog-Generator)*
|
data/CONTRIBUTING.md
DELETED
data/Gemfile
DELETED
data/README.md
DELETED
@@ -1,421 +0,0 @@
|
|
1
|
-
# Knife Cloud
|
2
|
-
|
3
|
-
[![Build Status](https://travis-ci.org/chef/knife-cloud.svg?branch=master)](https://travis-ci.org/chef/knife-cloud)
|
4
|
-
[![Code Climate](http://img.shields.io/codeclimate/github/opscode/knife-cloud.svg)][codeclimate]
|
5
|
-
|
6
|
-
[codeclimate]: https://codeclimate.com/github/chef/knife-cloud
|
7
|
-
|
8
|
-
## Description
|
9
|
-
|
10
|
-
`knife-cloud` is a library for implementing knife plugins that integrate cloud
|
11
|
-
infrastructure with Chef. For more information about knife and Chef visit https://chef.io/chef.
|
12
|
-
|
13
|
-
## Purpose
|
14
|
-
|
15
|
-
The knife-cloud library has been designed to integrate the common tasks of all knife plugins. As a developer of a knife plugin, you will not have to worry about writing generic code in your plugin, eg: the Chef bootstrap code or SSH / WinRM connection code.
|
16
|
-
|
17
|
-
## Installation
|
18
|
-
|
19
|
-
This library is distributed as a Ruby Gem. To install it, run:
|
20
|
-
|
21
|
-
$ gem install knife-cloud
|
22
|
-
$ # OR
|
23
|
-
$ chef exec gem install knife-cloud
|
24
|
-
|
25
|
-
Depending on your system's configuration, you may need to run this command with root privileges.
|
26
|
-
Alternatively, you can build the gem from the knife-cloud source code.
|
27
|
-
|
28
|
-
$ git clone https://github.com/chef/knife-cloud
|
29
|
-
$ cd knife-cloud
|
30
|
-
$ rake gem
|
31
|
-
$ gem install knife-cloud-x.y.z.gem
|
32
|
-
|
33
|
-
## Writing your custom plugin
|
34
|
-
|
35
|
-
General documentation of how to develop a knife plugin can be found in
|
36
|
-
[Chef documentation](http://docs.chef.io/plugin_knife_custom.html). Use of
|
37
|
-
the `knife-cloud` gem to implement the plugin automates many aspects of the
|
38
|
-
process.
|
39
|
-
|
40
|
-
Here is an example of how `knife-cloud` can be used. First, create a new ruby project, say knife-myplugin. Add the knife-cloud gem to its gemspec.
|
41
|
-
|
42
|
-
Sample gemspec:
|
43
|
-
|
44
|
-
# -*- encoding: utf-8 -*-
|
45
|
-
$:.push File.expand_path("../lib", __FILE__)
|
46
|
-
require "knife-myplugin/version"
|
47
|
-
|
48
|
-
Gem::Specification.new do |s|
|
49
|
-
s.name = "knife-myplugin"
|
50
|
-
s.version = Knife::Myplugin::VERSION
|
51
|
-
s.platform = Gem::Platform::RUBY
|
52
|
-
s.has_rdoc = true
|
53
|
-
s.extra_rdoc_files = ["README.md", "LICENSE" ]
|
54
|
-
s.authors = ["RockingSoul"]
|
55
|
-
s.email = ["rocking.soul@dreamworld.com"]
|
56
|
-
s.homepage = "https://github.com/dreamworld/knife-myplugin"
|
57
|
-
s.summary = %q{TODO}
|
58
|
-
s.description = %q{TODO}
|
59
|
-
|
60
|
-
s.files = `git ls-files`.split("\n")
|
61
|
-
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
62
|
-
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
63
|
-
s.require_paths = ["lib"]
|
64
|
-
|
65
|
-
s.add_dependency "knife-cloud"
|
66
|
-
|
67
|
-
%w(rspec-core rspec-expectations rspec-mocks rspec_junit_formatter).each { |gem| s.add_development_dependency gem }
|
68
|
-
end
|
69
|
-
|
70
|
-
Sample Gemfile:
|
71
|
-
|
72
|
-
source "https://rubygems.org"
|
73
|
-
|
74
|
-
# Specify your gem's dependencies in knife-<yourcloud>.gemspec
|
75
|
-
gemspec
|
76
|
-
|
77
|
-
group :development do
|
78
|
-
gem 'rspec', '>= 2.7.0'
|
79
|
-
gem 'guard-rspec'
|
80
|
-
gem 'rspec_junit_formatter'
|
81
|
-
gem 'rake'
|
82
|
-
gem 'mixlib-shellout'
|
83
|
-
end
|
84
|
-
|
85
|
-
### Code structure
|
86
|
-
|
87
|
-
Create a new ruby project, say knife-myplugin. Its code structure will look like:
|
88
|
-
|
89
|
-
lib
|
90
|
-
chef
|
91
|
-
knife
|
92
|
-
cloud
|
93
|
-
myplugin_service.rb
|
94
|
-
myplugin_service_options.rb
|
95
|
-
myplugin_server_create_options.rb
|
96
|
-
myplugin_server_create.rb
|
97
|
-
myplugin_server_delete.rb
|
98
|
-
myplugin_server_list.rb
|
99
|
-
myplugin_flavor_list.rb
|
100
|
-
|
101
|
-
### Service
|
102
|
-
|
103
|
-
- myplugin_service.rb
|
104
|
-
|
105
|
-
Knife-cloud has a wrapper written for the Fog service. It can be used in your plugin as mentioned in the steps below. If ruby Fog does not have support for your cloud provider, you will have to write your own Service class analogous to the Chef::Knife::Cloud::FogService class which is defined in knife-cloud.
|
106
|
-
* Add a dependency on the desired version of the `Fog` gem to your plugin's gemspec.
|
107
|
-
* Implement your Service class which should inherit from the FogService class.
|
108
|
-
|
109
|
-
Example Code:
|
110
|
-
|
111
|
-
require 'chef/knife/cloud/fog/service'
|
112
|
-
class Chef
|
113
|
-
class Knife
|
114
|
-
class Cloud
|
115
|
-
class MypluginService < FogService
|
116
|
-
|
117
|
-
def initialize(options = {})
|
118
|
-
# TODO - Add cloud specific auth params to be passed to fog connection. See knife-openstack for real life example.
|
119
|
-
super(options.merge({
|
120
|
-
:auth_params => {
|
121
|
-
:my_provider => 'MyPlugin',
|
122
|
-
:my_name => 'demo_name',
|
123
|
-
:my_password => 'demo_password'
|
124
|
-
}}))
|
125
|
-
end
|
126
|
-
|
127
|
-
end
|
128
|
-
end
|
129
|
-
end
|
130
|
-
end
|
131
|
-
|
132
|
-
#### Service Options
|
133
|
-
|
134
|
-
- myplugin_service_options.rb
|
135
|
-
|
136
|
-
This inherits all the options provided by Fog. You will have to add any cloud specific auth options.
|
137
|
-
|
138
|
-
Example Code:
|
139
|
-
|
140
|
-
require 'chef/knife/cloud/fog/options'
|
141
|
-
class Chef
|
142
|
-
class Knife
|
143
|
-
class Cloud
|
144
|
-
module MypluginServiceOptions
|
145
|
-
|
146
|
-
def self.included(includer)
|
147
|
-
includer.class_eval do
|
148
|
-
include FogOptions
|
149
|
-
|
150
|
-
# TODO - define your cloud specific auth options.
|
151
|
-
# Example:
|
152
|
-
# Myplugin Connection params.
|
153
|
-
# option :azure_username,
|
154
|
-
# :short => "-A USERNAME",
|
155
|
-
# :long => "--myplugin-username KEY",
|
156
|
-
# :description => "Your Myplugin Username",
|
157
|
-
# :proc => Proc.new { |key| Chef::Config[:knife][:myplugin_username] = key }
|
158
|
-
end
|
159
|
-
end
|
160
|
-
end
|
161
|
-
end
|
162
|
-
end
|
163
|
-
end
|
164
|
-
|
165
|
-
### Server Create Command
|
166
|
-
|
167
|
-
- myplugin_server_create.rb
|
168
|
-
|
169
|
-
This class will inherit from the Chef::Knife::Cloud::ServerCreateCommand class.
|
170
|
-
|
171
|
-
require 'chef/knife/cloud/server/create_command'
|
172
|
-
require 'chef/knife/myplugin_helpers'
|
173
|
-
require 'chef/knife/cloud/myplugin_server_create_options'
|
174
|
-
require 'chef/knife/cloud/myplugin_service'
|
175
|
-
require 'chef/knife/cloud/myplugin_service_options'
|
176
|
-
require 'chef/knife/cloud/exceptions'
|
177
|
-
|
178
|
-
class Chef
|
179
|
-
class Knife
|
180
|
-
class Cloud
|
181
|
-
class MypluginServerCreate < ServerCreateCommand
|
182
|
-
include MypluginHelpers
|
183
|
-
include MypluginServerCreateOptions
|
184
|
-
include MypluginServiceOptions
|
185
|
-
|
186
|
-
banner "knife myplugin server create (options)"
|
187
|
-
|
188
|
-
end
|
189
|
-
end
|
190
|
-
end
|
191
|
-
end
|
192
|
-
|
193
|
-
##### Override the methods below for plugin specific execution
|
194
|
-
- before_exec_command
|
195
|
-
|
196
|
-
- after_exec_command
|
197
|
-
|
198
|
-
- before_bootstrap
|
199
|
-
|
200
|
-
- validate_params!
|
201
|
-
|
202
|
-
##### Code Example
|
203
|
-
|
204
|
-
Following is the code template for the above methods
|
205
|
-
|
206
|
-
def before_exec_command
|
207
|
-
# setup the create options
|
208
|
-
# TODO - update this section to define the server_def that should be passed to fog for creating VM. This will be specific to your cloud.
|
209
|
-
# Example:
|
210
|
-
@create_options = {
|
211
|
-
:server_def => {
|
212
|
-
# servers require a name, knife-cloud generates the chef_node_name
|
213
|
-
:name => config[:chef_node_name],
|
214
|
-
:image_ref => locate_config_value(:image),
|
215
|
-
:flavor_ref => locate_config_value(:flavor),
|
216
|
-
#...
|
217
|
-
},
|
218
|
-
:server_create_timeout => locate_config_value(:server_create_timeout)
|
219
|
-
}
|
220
|
-
|
221
|
-
@create_options[:server_def].merge!({:user_data => locate_config_value(:user_data)}) if locate_config_value(:user_data)
|
222
|
-
|
223
|
-
Chef::Log.debug("Create server params - server_def = #{@create_options[:server_def]}")
|
224
|
-
|
225
|
-
# TODO - Update the columns info with the keys and callbacks required as per fog object returned for your cloud. Framework looks for 'key' on your image object hash returned by fog. If you need the values to be formatted or if your value is another object that needs to be looked up use value_callback.
|
226
|
-
# Example:
|
227
|
-
@columns_with_info = [
|
228
|
-
{:label => 'Instance ID', :key => 'id'},
|
229
|
-
{:label => 'Name', :key => 'name'},
|
230
|
-
{:label => 'Public IP', :key => 'addresses', :value_callback => method(:primary_public_ip_address)},
|
231
|
-
{:label => 'Private IP', :key => 'addresses', :value_callback => method(:primary_private_ip_address)},
|
232
|
-
{:label => 'Flavor', :key => 'flavor', :value_callback => method(:get_id)},
|
233
|
-
{:label => 'Image', :key => 'image', :value_callback => method(:get_id)},
|
234
|
-
{:label => 'Keypair', :key => 'key_name'},
|
235
|
-
{:label => 'State', :key => 'state'}
|
236
|
-
]
|
237
|
-
super
|
238
|
-
end
|
239
|
-
|
240
|
-
def get_id(value)
|
241
|
-
value['id']
|
242
|
-
end
|
243
|
-
|
244
|
-
# Setup the floating ip after server creation.
|
245
|
-
def after_exec_command
|
246
|
-
# Any action you want to perform post VM creation in your cloud.
|
247
|
-
# Example say assigning floating IP to the newly created VM.
|
248
|
-
# Make calls to "service" object if you need any information for cloud, example service.connection.addresses
|
249
|
-
# Make call to "server" object if you want set properties on newly created VM, example server.associate_address(floating_address)
|
250
|
-
|
251
|
-
super
|
252
|
-
end
|
253
|
-
|
254
|
-
def before_bootstrap
|
255
|
-
super
|
256
|
-
# TODO - Set the IP address that should be used for connection with the newly created VM. This IP address is used for bootstrapping the VM and should be accessible from knife workstation.
|
257
|
-
|
258
|
-
# your logic goes here to set bootstrap_ip_address...
|
259
|
-
|
260
|
-
Chef::Log.debug("Bootstrap IP Address: #{bootstrap_ip_address}")
|
261
|
-
if bootstrap_ip_address.nil?
|
262
|
-
error_message = "No IP address available for bootstrapping."
|
263
|
-
ui.error(error_message)
|
264
|
-
raise CloudExceptions::BootstrapError, error_message
|
265
|
-
end
|
266
|
-
config[:bootstrap_ip_address] = bootstrap_ip_address
|
267
|
-
end
|
268
|
-
|
269
|
-
def validate_params!
|
270
|
-
super
|
271
|
-
errors = []
|
272
|
-
|
273
|
-
# TODO - Add your validation here for any create server parameters and populate errors [] with error message strings.
|
274
|
-
|
275
|
-
# errors << "your error message" if some_param_undefined
|
276
|
-
|
277
|
-
error_message = ""
|
278
|
-
raise CloudExceptions::ValidationError, error_message if errors.each{|e| ui.error(e); error_message = "#{error_message} #{e}."}.any?
|
279
|
-
end
|
280
|
-
|
281
|
-
### Server Delete Command
|
282
|
-
|
283
|
-
- myplugin_server_delete.rb
|
284
|
-
|
285
|
-
You may just need to create your MypluginServerDelete class here. Unless your plugin has some very specific delete server case, you can leave the code just like shown in the example below:
|
286
|
-
|
287
|
-
require 'chef/knife/cloud/server/delete_options'
|
288
|
-
require 'chef/knife/cloud/server/delete_command'
|
289
|
-
require 'chef/knife/cloud/myplugin_service'
|
290
|
-
require 'chef/knife/cloud/myplugin_service_options'
|
291
|
-
require 'chef/knife/myplugin_helpers'
|
292
|
-
|
293
|
-
class Chef
|
294
|
-
class Knife
|
295
|
-
class Cloud
|
296
|
-
class MypluginServerDelete < ServerDeleteCommand
|
297
|
-
include ServerDeleteOptions
|
298
|
-
include MypluginServiceOptions
|
299
|
-
include MypluginHelpers
|
300
|
-
|
301
|
-
banner "knife myplugin server delete INSTANCEID [INSTANCEID] (options)"
|
302
|
-
|
303
|
-
end
|
304
|
-
end
|
305
|
-
end
|
306
|
-
end
|
307
|
-
|
308
|
-
### Server List Command
|
309
|
-
|
310
|
-
- myplugin_server_list.rb
|
311
|
-
|
312
|
-
Your class MypluginServerList should inherit from Chef::Knife::Cloud::ServerListCommand class.
|
313
|
-
|
314
|
-
Example -
|
315
|
-
require 'chef/knife/cloud/server/list_command'
|
316
|
-
require 'chef/knife/myplugin_helpers'
|
317
|
-
require 'chef/knife/cloud/myplugin_service_options'
|
318
|
-
require 'chef/knife/cloud/server/list_options'
|
319
|
-
|
320
|
-
class Chef
|
321
|
-
class Knife
|
322
|
-
class Cloud
|
323
|
-
class MypluginServerList < ServerListCommand
|
324
|
-
include MypluginHelpers
|
325
|
-
include MypluginServiceOptions
|
326
|
-
include ServerListOptions
|
327
|
-
|
328
|
-
banner "knife myplugin server list (options)"
|
329
|
-
|
330
|
-
def before_exec_command
|
331
|
-
# TODO - Update the columns info with the keys and callbacks required as per fog object returned for your cloud. Framework looks for 'key' on your server object hash returned by fog. If you need the values to be formatted or if your value is another object that needs to be looked up use value_callback.
|
332
|
-
|
333
|
-
@columns_with_info = [
|
334
|
-
{:label => 'Instance ID', :key => 'id'},
|
335
|
-
{:label => 'Name', :key => 'name'},
|
336
|
-
{:label => 'Public IP', :key => 'addresses', :value_callback => method(:your_callback)},
|
337
|
-
#...
|
338
|
-
]
|
339
|
-
super
|
340
|
-
end
|
341
|
-
|
342
|
-
# TODO - callback example, this gets a object/value returned by server.addresses
|
343
|
-
def your_callback (addresses)
|
344
|
-
#...
|
345
|
-
end
|
346
|
-
|
347
|
-
end
|
348
|
-
end
|
349
|
-
end
|
350
|
-
end
|
351
|
-
|
352
|
-
### Flavor List Command
|
353
|
-
|
354
|
-
- myplugin_flavor_list.rb
|
355
|
-
|
356
|
-
For all other list commands other than the server-list, they must inherit from the Chef::Knife::Cloud::ResourceListCommand class.
|
357
|
-
|
358
|
-
Example -
|
359
|
-
|
360
|
-
require 'chef/knife/cloud/list_resource_command'
|
361
|
-
require 'chef/knife/myplugin_helpers'
|
362
|
-
require 'chef/knife/cloud/myplugin_service_options'
|
363
|
-
|
364
|
-
class Chef
|
365
|
-
class Knife
|
366
|
-
class Cloud
|
367
|
-
class MypluginFlavorList < ResourceListCommand
|
368
|
-
include MypluginHelpers
|
369
|
-
include MypluginServiceOptions
|
370
|
-
|
371
|
-
banner "knife myplugin flavor list (options)"
|
372
|
-
|
373
|
-
def before_exec_command
|
374
|
-
# Set columns_with_info map
|
375
|
-
# TODO - Update the columns info with the keys and callbacks required as per fog object returned for your cloud. Framework looks for 'key' on your flavor object hash returned by fog. If you need the values to be formatted or if your value is another object that needs to be looked up use value_callback.
|
376
|
-
# Example:
|
377
|
-
@columns_with_info = [
|
378
|
-
{:label => 'ID', :key => 'id'},
|
379
|
-
{:label => 'Name', :key => 'name'},
|
380
|
-
{:label => 'Virtual CPUs', :key => 'vcpus'},
|
381
|
-
{:label => 'RAM', :key => 'ram', :value_callback => method(:ram_in_mb)},
|
382
|
-
{:label => 'Disk', :key => 'disk', :value_callback => method(:disk_in_gb)}
|
383
|
-
]
|
384
|
-
end
|
385
|
-
|
386
|
-
def query_resource
|
387
|
-
@service.list_resource_configurations
|
388
|
-
end
|
389
|
-
|
390
|
-
# TODO - This is just for example
|
391
|
-
def ram_in_mb(ram)
|
392
|
-
"#{ram} MB"
|
393
|
-
end
|
394
|
-
|
395
|
-
# TODO - This is just for example
|
396
|
-
def disk_in_gb(disk)
|
397
|
-
"#{disk} GB"
|
398
|
-
end
|
399
|
-
|
400
|
-
end
|
401
|
-
end
|
402
|
-
end
|
403
|
-
end
|
404
|
-
|
405
|
-
## License
|
406
|
-
|
407
|
-
Copyright:: Copyright (c) 2014-2015 Chef Software, Inc.
|
408
|
-
|
409
|
-
License:: Apache License, Version 2.0
|
410
|
-
|
411
|
-
Licensed under the Apache License, Version 2.0 (the "License");
|
412
|
-
you may not use this file except in compliance with the License.
|
413
|
-
You may obtain a copy of the License at
|
414
|
-
|
415
|
-
http://www.apache.org/licenses/LICENSE-2.0
|
416
|
-
|
417
|
-
Unless required by applicable law or agreed to in writing, software
|
418
|
-
distributed under the License is distributed on an "AS IS" BASIS,
|
419
|
-
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
420
|
-
See the License for the specific language governing permissions and
|
421
|
-
limitations under the License.
|