knife-linode 0.3.2 → 0.3.3
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 +5 -5
- data/.expeditor/config.yml +44 -0
- data/.expeditor/update_version.sh +12 -0
- data/.github/CODEOWNERS +5 -0
- data/.github/ISSUE_TEMPLATE/BUG_TEMPLATE.md +29 -0
- data/.github/ISSUE_TEMPLATE/DESIGN_PROPOSAL.md +40 -0
- data/.github/ISSUE_TEMPLATE/ENHANCEMENT_REQUEST_TEMPLATE.md +17 -0
- data/.github/ISSUE_TEMPLATE/SUPPORT_QUESTION.md +12 -0
- data/.github/PULL_REQUEST_TEMPLATE.md +15 -0
- data/.github/lock.yml +1 -0
- data/.gitignore +25 -2
- data/.rspec +3 -0
- data/.rubocop.yml +12 -0
- data/.travis.yml +20 -5
- data/CHANGELOG.md +15 -0
- data/Gemfile +28 -2
- data/README.md +64 -72
- data/Rakefile +22 -43
- data/VERSION +1 -0
- data/knife-linode.gemspec +8 -10
- data/lib/chef/knife/linode_base.rb +13 -14
- data/lib/chef/knife/linode_datacenter_list.rb +7 -9
- data/lib/chef/knife/linode_flavor_list.rb +10 -12
- data/lib/chef/knife/linode_image_list.rb +9 -11
- data/lib/chef/knife/linode_kernel_list.rb +7 -9
- data/lib/chef/knife/linode_server_create.rb +34 -32
- data/lib/chef/knife/linode_server_delete.rb +12 -16
- data/lib/chef/knife/linode_server_list.rb +14 -16
- data/lib/chef/knife/linode_server_reboot.rb +7 -9
- data/lib/chef/knife/linode_stackscript_list.rb +5 -7
- data/lib/knife-linode/version.rb +2 -2
- data/spec/chef/knife/linode_datacenter_list_spec.rb +3 -3
- data/spec/chef/knife/linode_flavor_list_spec.rb +3 -3
- data/spec/chef/knife/linode_server_create_spec.rb +17 -15
- data/spec/chef/knife/linode_server_list_spec.rb +3 -3
- data/spec/spec_helper.rb +3 -3
- metadata +35 -59
data/Rakefile
CHANGED
@@ -1,56 +1,35 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
# Copyright:: Copyright (c) 2008, 2010 Opscode, Inc.
|
6
|
-
# License:: Apache License, Version 2.0
|
7
|
-
#
|
8
|
-
# Licensed under the Apache License, Version 2.0 (the "License");
|
9
|
-
# you may not use this file except in compliance with the License.
|
10
|
-
# You may obtain a copy of the License at
|
11
|
-
#
|
12
|
-
# http://www.apache.org/licenses/LICENSE-2.0
|
13
|
-
#
|
14
|
-
# Unless required by applicable law or agreed to in writing, software
|
15
|
-
# distributed under the License is distributed on an "AS IS" BASIS,
|
16
|
-
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
17
|
-
# See the License for the specific language governing permissions and
|
18
|
-
# limitations under the License.
|
19
|
-
#
|
1
|
+
require "bundler/gem_tasks"
|
2
|
+
require "rspec/core/rake_task"
|
3
|
+
|
4
|
+
task default: %i{style spec}
|
20
5
|
|
21
|
-
require 'bundler'
|
22
6
|
Bundler::GemHelper.install_tasks
|
23
7
|
|
24
|
-
|
25
|
-
|
26
|
-
|
8
|
+
desc "Run specs"
|
9
|
+
RSpec::Core::RakeTask.new(:spec) do |spec|
|
10
|
+
spec.pattern = "spec/**/*_spec.rb"
|
11
|
+
end
|
27
12
|
|
28
13
|
begin
|
29
|
-
require
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
rdoc.main = "README.rdoc"
|
34
|
-
rdoc.options << '--fmt' << 'shtml' # explictly set shtml generator
|
35
|
-
rdoc.template = 'direct' # lighter template
|
36
|
-
rdoc.rdoc_files.include("README.rdoc", "LICENSE", "spec/tiny_server.rb", "lib/**/*.rb")
|
37
|
-
rdoc.rdoc_dir = "rdoc"
|
14
|
+
require "chefstyle"
|
15
|
+
require "rubocop/rake_task"
|
16
|
+
RuboCop::RakeTask.new(:style) do |task|
|
17
|
+
task.options += ["--display-cop-names", "--no-color"]
|
38
18
|
end
|
39
19
|
rescue LoadError
|
40
|
-
puts "
|
20
|
+
puts "chefstyle/rubocop is not available. bundle install first to make sure all dependencies are installed."
|
41
21
|
end
|
42
22
|
|
43
23
|
begin
|
44
|
-
require
|
45
|
-
|
46
|
-
task :default => :spec
|
47
|
-
|
48
|
-
desc "Run all specs in spec directory"
|
49
|
-
RSpec::Core::RakeTask.new(:spec) do |t|
|
50
|
-
t.pattern = 'spec/unit/**/*_spec.rb'
|
51
|
-
end
|
52
|
-
|
24
|
+
require "yard"
|
25
|
+
YARD::Rake::YardocTask.new(:docs)
|
53
26
|
rescue LoadError
|
54
|
-
|
27
|
+
puts "yard is not available. bundle install first to make sure all dependencies are installed."
|
55
28
|
end
|
56
29
|
|
30
|
+
task :console do
|
31
|
+
require "irb"
|
32
|
+
require "irb/completion"
|
33
|
+
ARGV.clear
|
34
|
+
IRB.start
|
35
|
+
end
|
data/VERSION
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
0.3.3
|
data/knife-linode.gemspec
CHANGED
@@ -5,21 +5,19 @@ require "knife-linode/version"
|
|
5
5
|
Gem::Specification.new do |s|
|
6
6
|
s.name = "knife-linode"
|
7
7
|
s.version = Knife::Linode::VERSION
|
8
|
-
s.authors = [
|
9
|
-
s.email = [
|
10
|
-
s.
|
8
|
+
s.authors = ["Adam Jacob", "Seth Chisamore", "Lamont Granquist", "Jesse R. Adams"]
|
9
|
+
s.email = ["adam@chef.io", "schisamo@chef.io", "lamont@chef.io", "jesse@techno-geeks.org"]
|
10
|
+
s.license = "Apache-2.0"
|
11
|
+
s.homepage = "https://github.com/chef/knife-linode"
|
11
12
|
s.summary = "Linode Support for Chef's Knife Command"
|
12
13
|
s.description = s.summary
|
13
|
-
s.extra_rdoc_files = [
|
14
|
+
s.extra_rdoc_files = ["README.md", "LICENSE"]
|
14
15
|
|
16
|
+
s.required_ruby_version = ">= 2.2.2"
|
15
17
|
s.files = `git ls-files`.split("\n")
|
16
18
|
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
17
|
-
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
19
|
+
s.executables = `git ls-files -- bin/*`.split("\n").map { |f| File.basename(f) }
|
18
20
|
s.require_paths = ["lib"]
|
19
21
|
|
20
|
-
s.add_runtime_dependency "fog",
|
21
|
-
s.add_runtime_dependency "chef", ">= 11.8"
|
22
|
-
|
23
|
-
s.add_development_dependency "rspec", "~> 3.0"
|
24
|
-
s.add_development_dependency "rubocop", "~> 0.24"
|
22
|
+
s.add_runtime_dependency "fog", "~> 1.0"
|
25
23
|
end
|
@@ -1,7 +1,7 @@
|
|
1
1
|
#
|
2
|
-
# Author:: Seth Chisamore (<schisamo@
|
3
|
-
# Author:: Lamont Granquist (<lamont@
|
4
|
-
# Copyright:: Copyright (c) 2011
|
2
|
+
# Author:: Seth Chisamore (<schisamo@chef.io>)
|
3
|
+
# Author:: Lamont Granquist (<lamont@chef.io>)
|
4
|
+
# Copyright:: Copyright (c) 2011-2016 Chef Software, Inc.
|
5
5
|
# License:: Apache License, Version 2.0
|
6
6
|
#
|
7
7
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
@@ -17,7 +17,7 @@
|
|
17
17
|
# limitations under the License.
|
18
18
|
#
|
19
19
|
|
20
|
-
require
|
20
|
+
require "chef/knife"
|
21
21
|
|
22
22
|
class Chef
|
23
23
|
class Knife
|
@@ -30,9 +30,9 @@ class Chef
|
|
30
30
|
includer.class_eval do
|
31
31
|
|
32
32
|
deps do
|
33
|
-
require
|
34
|
-
require
|
35
|
-
require
|
33
|
+
require "fog"
|
34
|
+
require "readline"
|
35
|
+
require "chef/json_compat"
|
36
36
|
end
|
37
37
|
|
38
38
|
option :linode_api_key,
|
@@ -47,7 +47,7 @@ class Chef
|
|
47
47
|
def connection
|
48
48
|
@connection ||= begin
|
49
49
|
connection = Fog::Compute.new(
|
50
|
-
:provider =>
|
50
|
+
:provider => "Linode",
|
51
51
|
:linode_api_key => Chef::Config[:knife][:linode_api_key]
|
52
52
|
)
|
53
53
|
end
|
@@ -58,23 +58,23 @@ class Chef
|
|
58
58
|
config[key] || Chef::Config[:knife][key]
|
59
59
|
end
|
60
60
|
|
61
|
-
def msg_pair(label, value, color
|
61
|
+
def msg_pair(label, value, color = :cyan)
|
62
62
|
if value && !value.empty?
|
63
63
|
puts "#{ui.color(label, color)}: #{value}"
|
64
64
|
end
|
65
65
|
end
|
66
66
|
|
67
|
-
def validate!(keys=[:linode_api_key])
|
67
|
+
def validate!(keys = [:linode_api_key])
|
68
68
|
errors = []
|
69
69
|
|
70
70
|
keys.each do |k|
|
71
|
-
pretty_key = k.to_s.
|
71
|
+
pretty_key = k.to_s.tr("_", " ").gsub(/\w+/) { |w| (w =~ /(api)/i) ? w.upcase : w.capitalize }
|
72
72
|
if Chef::Config[:knife][k].nil?
|
73
|
-
errors << "You did not provide a valid '#{pretty_key}' value."
|
73
|
+
errors << "You did not provide a valid '#{pretty_key}' value in your knife as #{k}."
|
74
74
|
end
|
75
75
|
end
|
76
76
|
|
77
|
-
if errors.each{|e| ui.error(e)}.any?
|
77
|
+
if errors.each { |e| ui.error(e) }.any?
|
78
78
|
exit 1
|
79
79
|
end
|
80
80
|
end
|
@@ -101,4 +101,3 @@ class Chef
|
|
101
101
|
end
|
102
102
|
end
|
103
103
|
end
|
104
|
-
|
@@ -1,8 +1,8 @@
|
|
1
1
|
|
2
|
-
# Author:: Adam Jacob (<adam@
|
3
|
-
# Author:: Seth Chisamore (<schisamo@
|
4
|
-
# Author:: Lamont Granquist (<lamont@
|
5
|
-
# Copyright:: Copyright (c) 2010-
|
2
|
+
# Author:: Adam Jacob (<adam@chef.io>)
|
3
|
+
# Author:: Seth Chisamore (<schisamo@chef.io>)
|
4
|
+
# Author:: Lamont Granquist (<lamont@chef.io>)
|
5
|
+
# Copyright:: Copyright (c) 2010-2016 Chef Software, Inc.
|
6
6
|
# License:: Apache License, Version 2.0
|
7
7
|
#
|
8
8
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
@@ -18,7 +18,7 @@
|
|
18
18
|
# limitations under the License.
|
19
19
|
#
|
20
20
|
|
21
|
-
require
|
21
|
+
require "chef/knife/linode_base"
|
22
22
|
|
23
23
|
class Chef
|
24
24
|
class Knife
|
@@ -29,11 +29,10 @@ class Chef
|
|
29
29
|
banner "knife linode datacenter list (options)"
|
30
30
|
|
31
31
|
def run
|
32
|
-
|
33
32
|
validate!
|
34
33
|
server_list = [
|
35
|
-
ui.color(
|
36
|
-
ui.color(
|
34
|
+
ui.color("ID", :bold),
|
35
|
+
ui.color("Location", :bold),
|
37
36
|
]
|
38
37
|
|
39
38
|
connection.data_centers.each do |datacenter|
|
@@ -42,7 +41,6 @@ class Chef
|
|
42
41
|
end
|
43
42
|
|
44
43
|
puts ui.list(server_list, :columns_across, 2)
|
45
|
-
|
46
44
|
end
|
47
45
|
end
|
48
46
|
end
|
@@ -1,8 +1,8 @@
|
|
1
1
|
|
2
|
-
# Author:: Adam Jacob (<adam@
|
3
|
-
# Author:: Seth Chisamore (<schisamo@
|
4
|
-
# Author:: Lamont Granquist (<lamont@
|
5
|
-
# Copyright:: Copyright (c) 2010-
|
2
|
+
# Author:: Adam Jacob (<adam@chef.io>)
|
3
|
+
# Author:: Seth Chisamore (<schisamo@chef.io>)
|
4
|
+
# Author:: Lamont Granquist (<lamont@chef.io>)
|
5
|
+
# Copyright:: Copyright (c) 2010-2016 Chef Software, Inc.
|
6
6
|
# License:: Apache License, Version 2.0
|
7
7
|
#
|
8
8
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
@@ -18,7 +18,7 @@
|
|
18
18
|
# limitations under the License.
|
19
19
|
#
|
20
20
|
|
21
|
-
require
|
21
|
+
require "chef/knife/linode_base"
|
22
22
|
|
23
23
|
class Chef
|
24
24
|
class Knife
|
@@ -29,15 +29,14 @@ class Chef
|
|
29
29
|
banner "knife linode flavor list (options)"
|
30
30
|
|
31
31
|
def run
|
32
|
-
|
33
32
|
validate!
|
34
33
|
|
35
34
|
server_list = [
|
36
|
-
ui.color(
|
37
|
-
ui.color(
|
38
|
-
ui.color(
|
39
|
-
ui.color(
|
40
|
-
ui.color(
|
35
|
+
ui.color("ID", :bold),
|
36
|
+
ui.color("Name", :bold),
|
37
|
+
ui.color("RAM", :bold),
|
38
|
+
ui.color("Disk", :bold),
|
39
|
+
ui.color("Price", :bold),
|
41
40
|
]
|
42
41
|
|
43
42
|
connection.flavors.each do |flavor|
|
@@ -49,7 +48,6 @@ class Chef
|
|
49
48
|
end
|
50
49
|
|
51
50
|
puts ui.list(server_list, :columns_across, 5)
|
52
|
-
|
53
51
|
end
|
54
52
|
end
|
55
53
|
end
|
@@ -1,8 +1,8 @@
|
|
1
1
|
|
2
|
-
# Author:: Adam Jacob (<adam@
|
3
|
-
# Author:: Seth Chisamore (<schisamo@
|
4
|
-
# Author:: Lamont Granquist (<lamont@
|
5
|
-
# Copyright:: Copyright (c) 2010-
|
2
|
+
# Author:: Adam Jacob (<adam@chef.io>)
|
3
|
+
# Author:: Seth Chisamore (<schisamo@chef.io>)
|
4
|
+
# Author:: Lamont Granquist (<lamont@chef.io>)
|
5
|
+
# Copyright:: Copyright (c) 2010-2016 Chef Software, Inc.
|
6
6
|
# License:: Apache License, Version 2.0
|
7
7
|
#
|
8
8
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
@@ -18,7 +18,7 @@
|
|
18
18
|
# limitations under the License.
|
19
19
|
#
|
20
20
|
|
21
|
-
require
|
21
|
+
require "chef/knife/linode_base"
|
22
22
|
|
23
23
|
class Chef
|
24
24
|
class Knife
|
@@ -29,14 +29,13 @@ class Chef
|
|
29
29
|
banner "knife linode image list (options)"
|
30
30
|
|
31
31
|
def run
|
32
|
-
|
33
32
|
validate!
|
34
33
|
|
35
34
|
server_list = [
|
36
|
-
ui.color(
|
37
|
-
ui.color(
|
38
|
-
ui.color(
|
39
|
-
ui.color(
|
35
|
+
ui.color("ID", :bold),
|
36
|
+
ui.color("Name", :bold),
|
37
|
+
ui.color("Bits", :bold),
|
38
|
+
ui.color("Image Size", :bold),
|
40
39
|
]
|
41
40
|
|
42
41
|
connection.images.each do |image|
|
@@ -47,7 +46,6 @@ class Chef
|
|
47
46
|
end
|
48
47
|
|
49
48
|
puts ui.list(server_list, :columns_across, 4)
|
50
|
-
|
51
49
|
end
|
52
50
|
end
|
53
51
|
end
|
@@ -1,8 +1,8 @@
|
|
1
1
|
|
2
|
-
# Author:: Adam Jacob (<adam@
|
3
|
-
# Author:: Seth Chisamore (<schisamo@
|
4
|
-
# Author:: Lamont Granquist (<lamont@
|
5
|
-
# Copyright:: Copyright (c) 2010-
|
2
|
+
# Author:: Adam Jacob (<adam@chef.io>)
|
3
|
+
# Author:: Seth Chisamore (<schisamo@chef.io>)
|
4
|
+
# Author:: Lamont Granquist (<lamont@chef.io>)
|
5
|
+
# Copyright:: Copyright (c) 2010-2016 Chef Software, Inc.
|
6
6
|
# License:: Apache License, Version 2.0
|
7
7
|
#
|
8
8
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
@@ -18,7 +18,7 @@
|
|
18
18
|
# limitations under the License.
|
19
19
|
#
|
20
20
|
|
21
|
-
require
|
21
|
+
require "chef/knife/linode_base"
|
22
22
|
|
23
23
|
class Chef
|
24
24
|
class Knife
|
@@ -29,12 +29,11 @@ class Chef
|
|
29
29
|
banner "knife linode kernel list (options)"
|
30
30
|
|
31
31
|
def run
|
32
|
-
|
33
32
|
validate!
|
34
33
|
|
35
34
|
server_list = [
|
36
|
-
ui.color(
|
37
|
-
ui.color(
|
35
|
+
ui.color("ID", :bold),
|
36
|
+
ui.color("Name", :bold),
|
38
37
|
]
|
39
38
|
|
40
39
|
connection.kernels.each do |kernel|
|
@@ -43,7 +42,6 @@ class Chef
|
|
43
42
|
end
|
44
43
|
|
45
44
|
puts ui.list(server_list, :columns_across, 2)
|
46
|
-
|
47
45
|
end
|
48
46
|
end
|
49
47
|
end
|
@@ -1,8 +1,8 @@
|
|
1
1
|
|
2
|
-
# Author:: Adam Jacob (<adam@
|
3
|
-
# Author:: Seth Chisamore (<schisamo@
|
4
|
-
# Author:: Lamont Granquist (<lamont@
|
5
|
-
# Copyright:: Copyright (c) 2010-
|
2
|
+
# Author:: Adam Jacob (<adam@chef.io>)
|
3
|
+
# Author:: Seth Chisamore (<schisamo@chef.io>)
|
4
|
+
# Author:: Lamont Granquist (<lamont@chef.io>)
|
5
|
+
# Copyright:: Copyright (c) 2010-2016 Chef Software, Inc.
|
6
6
|
# License:: Apache License, Version 2.0
|
7
7
|
#
|
8
8
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
@@ -18,7 +18,7 @@
|
|
18
18
|
# limitations under the License.
|
19
19
|
#
|
20
20
|
|
21
|
-
require
|
21
|
+
require "chef/knife/linode_base"
|
22
22
|
|
23
23
|
class Chef
|
24
24
|
class Knife
|
@@ -26,13 +26,13 @@ class Chef
|
|
26
26
|
|
27
27
|
include Knife::LinodeBase
|
28
28
|
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
29
|
+
deps do
|
30
|
+
require "fog"
|
31
|
+
require "readline"
|
32
|
+
require "chef/json_compat"
|
33
|
+
require "chef/knife/bootstrap"
|
34
|
+
Chef::Knife::Bootstrap.load_deps
|
35
|
+
end
|
36
36
|
|
37
37
|
banner "knife linode server create (options)"
|
38
38
|
|
@@ -83,7 +83,7 @@ class Chef
|
|
83
83
|
:default => "root"
|
84
84
|
|
85
85
|
chars = ("a".."z").to_a + ("1".."9").to_a + ("A".."Z").to_a
|
86
|
-
@@defpass = Array.new(20,
|
86
|
+
@@defpass = Array.new(20, "").collect { chars[rand(chars.size)] }.push("A").push("a").join
|
87
87
|
|
88
88
|
option :ssh_password,
|
89
89
|
:short => "-P PASSWORD",
|
@@ -138,13 +138,13 @@ class Chef
|
|
138
138
|
:boolean => true,
|
139
139
|
:default => true
|
140
140
|
|
141
|
-
Chef::Config[:knife][:hints] ||= {"linode" => {}}
|
141
|
+
Chef::Config[:knife][:hints] ||= { "linode" => {} }
|
142
142
|
option :hint,
|
143
143
|
:long => "--hint HINT_NAME[=HINT_FILE]",
|
144
|
-
:description => "Specify Ohai Hint to be set on the bootstrap target.
|
144
|
+
:description => "Specify Ohai Hint to be set on the bootstrap target. Use multiple --hint options to specify multiple hints.",
|
145
145
|
:proc => Proc.new { |h|
|
146
|
-
|
147
|
-
|
146
|
+
name, path = h.split("=")
|
147
|
+
Chef::Config[:knife][:hints][name] = path ? JSON.parse(::File.read(path)) : Hash.new
|
148
148
|
}
|
149
149
|
|
150
150
|
option :secret,
|
@@ -201,6 +201,8 @@ class Chef
|
|
201
201
|
|
202
202
|
validate!
|
203
203
|
|
204
|
+
raise "You must provide linode_node_name via the CLI or knife.rb config. See help for details" if locate_config_value(:linode_node_name).nil?
|
205
|
+
|
204
206
|
datacenter_id = locate_config_value(:linode_datacenter).to_i
|
205
207
|
datacenter = connection.data_centers.select { |dc| dc.id == datacenter_id }.first
|
206
208
|
|
@@ -226,7 +228,7 @@ class Chef
|
|
226
228
|
:password => locate_config_value(:ssh_password)
|
227
229
|
)
|
228
230
|
|
229
|
-
connection.linode_update(server.id, {:lpm_displaygroup => config[:display_group]}) if config[:display_group]
|
231
|
+
connection.linode_update(server.id, { :lpm_displaygroup => config[:display_group] }) if config[:display_group]
|
230
232
|
|
231
233
|
fqdn = server.ips.select { |lip| !( lip.ip =~ /^192\.168\./ || lip.ip =~ /^10\./ || lip.ip =~ /^172\.(1[6-9]|2[0-9]|3[0-1])\./ ) }.first.ip
|
232
234
|
|
@@ -243,25 +245,25 @@ class Chef
|
|
243
245
|
|
244
246
|
print "\n#{ui.color("Waiting for sshd", :magenta)}"
|
245
247
|
|
246
|
-
print(".") until tcp_test_ssh(fqdn)
|
248
|
+
print(".") until tcp_test_ssh(fqdn) do
|
247
249
|
sleep @initial_sleep_delay ||= 10
|
248
250
|
puts("done")
|
249
|
-
|
251
|
+
end
|
250
252
|
|
251
|
-
Chef::Config[:knife][:hints][
|
252
|
-
Chef::Config[:knife][:hints][
|
253
|
-
|
254
|
-
|
255
|
-
|
256
|
-
|
257
|
-
|
258
|
-
|
253
|
+
Chef::Config[:knife][:hints]["linode"] ||= Hash.new
|
254
|
+
Chef::Config[:knife][:hints]["linode"].merge!({
|
255
|
+
"server_id" => server.id.to_s,
|
256
|
+
"datacenter_id" => locate_config_value(:linode_datacenter),
|
257
|
+
"flavor_id" => locate_config_value(:linode_flavor),
|
258
|
+
"image_id" => locate_config_value(:linode_image),
|
259
|
+
"kernel_id" => locate_config_value(:linode_kernel),
|
260
|
+
"ip_addresses" => server.ips.map(&:ip) })
|
259
261
|
|
260
262
|
msg_pair("JSON Attributes", config[:json_attributes]) unless !config[:json_attributes] || config[:json_attributes].empty?
|
261
|
-
bootstrap_for_node(server,fqdn).run
|
263
|
+
bootstrap_for_node(server, fqdn).run
|
262
264
|
end
|
263
265
|
|
264
|
-
def bootstrap_for_node(server,fqdn)
|
266
|
+
def bootstrap_for_node(server, fqdn)
|
265
267
|
bootstrap = Chef::Knife::Bootstrap.new
|
266
268
|
bootstrap.name_args = [fqdn]
|
267
269
|
bootstrap.config[:run_list] = config[:run_list]
|
@@ -273,13 +275,13 @@ class Chef
|
|
273
275
|
bootstrap.config[:bootstrap_version] = locate_config_value(:bootstrap_version)
|
274
276
|
bootstrap.config[:first_boot_attributes] = locate_config_value(:json_attributes) || {}
|
275
277
|
bootstrap.config[:distro] = locate_config_value(:distro)
|
276
|
-
bootstrap.config[:use_sudo] = true unless config[:ssh_user] ==
|
278
|
+
bootstrap.config[:use_sudo] = true unless config[:ssh_user] == "root"
|
277
279
|
bootstrap.config[:template_file] = locate_config_value(:template_file)
|
278
280
|
bootstrap.config[:environment] = config[:environment]
|
279
281
|
bootstrap.config[:host_key_verify] = config[:host_key_verify]
|
280
282
|
bootstrap.config[:secret] = locate_config_value(:secret)
|
281
283
|
bootstrap.config[:secret_file] = locate_config_value(:secret_file)
|
282
|
-
bootstrap.config[:private_ip] = server.ips.reject{ |ip| ip.public }.first.ip
|
284
|
+
bootstrap.config[:private_ip] = server.ips.reject { |ip| ip.public }.first.ip
|
283
285
|
bootstrap.config[:public_ip] = server.public_ip_address
|
284
286
|
bootstrap
|
285
287
|
end
|