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
|
#
|
2
2
|
# Author:: Siddheshwar More (<siddheshwar.more@clogeny.com>)
|
3
|
-
# Copyright:: Copyright (c) 2013
|
3
|
+
# Copyright:: Copyright (c) 2013-2016 Chef Software, Inc.
|
4
4
|
# License:: Apache License, Version 2.0
|
5
5
|
#
|
6
6
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
@@ -24,20 +24,19 @@ class Chef
|
|
24
24
|
includer.class_eval do
|
25
25
|
|
26
26
|
option :chef_data,
|
27
|
-
:
|
28
|
-
:
|
29
|
-
:
|
30
|
-
:
|
27
|
+
long: "--chef-data",
|
28
|
+
boolean: true,
|
29
|
+
default: false,
|
30
|
+
description: "Display chef node data which include chef node name, environment name, fqdn, platform, runlist and tags."
|
31
31
|
|
32
32
|
option :chef_node_attribute,
|
33
|
-
:
|
34
|
-
:
|
35
|
-
:
|
36
|
-
|
33
|
+
long: "--chef-node-attribute CHEF_NODE_ATTRIBUTE_NAME",
|
34
|
+
description: "Used with --chef-data option. It display node attributes details by adding new column in server list display.",
|
35
|
+
proc: Proc.new { |i| Chef::Config[:knife][:chef_node_attribute] = i }
|
36
|
+
|
37
37
|
end
|
38
38
|
end
|
39
39
|
end
|
40
40
|
end
|
41
41
|
end
|
42
42
|
end
|
43
|
-
|
@@ -1,6 +1,6 @@
|
|
1
1
|
#
|
2
2
|
# Author:: Kaustubh Deorukhkar (<kaustubh@clogeny.com>)
|
3
|
-
# Copyright:: Copyright (c) 2013
|
3
|
+
# Copyright:: Copyright (c) 2013-2016 Chef Software, Inc.
|
4
4
|
# License:: Apache License, Version 2.0
|
5
5
|
#
|
6
6
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
@@ -23,14 +23,14 @@ class Chef
|
|
23
23
|
def self.included(includer)
|
24
24
|
includer.class_eval do
|
25
25
|
option :chef_node_name,
|
26
|
-
:
|
27
|
-
:
|
28
|
-
:
|
26
|
+
short: "-N NAME",
|
27
|
+
long: "--node-name NAME",
|
28
|
+
description: "The name of the node and client to delete, if it differs from the server name. Only has meaning when used with the '--purge' option."
|
29
29
|
|
30
30
|
option :custom_attributes,
|
31
|
-
:
|
32
|
-
:
|
33
|
-
:
|
31
|
+
long: "--custom-attributes CUSTOM_ATTRIBUTES",
|
32
|
+
description: "Custom attributes to be passed to Fog.",
|
33
|
+
proc: Proc.new { |args| Chef::Config[:knife][:custom_attributes] = args.split(";").map { |keys| keys.split("=") }.map { |j| Hash[*j.map { |k| k.strip }] } }
|
34
34
|
end
|
35
35
|
end
|
36
36
|
end
|
@@ -1,5 +1,5 @@
|
|
1
1
|
#
|
2
|
-
# Copyright:: Copyright (c) 2013
|
2
|
+
# Copyright:: Copyright (c) 2013-2016 Chef Software, Inc.
|
3
3
|
# License:: Apache License, Version 2.0
|
4
4
|
#
|
5
5
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
@@ -15,15 +15,15 @@
|
|
15
15
|
# limitations under the License.
|
16
16
|
#
|
17
17
|
|
18
|
-
require
|
19
|
-
require
|
18
|
+
require "chef/knife/cloud/command"
|
19
|
+
require "chef/knife/cloud/exceptions"
|
20
20
|
|
21
21
|
class Chef
|
22
22
|
class Knife
|
23
23
|
class Cloud
|
24
24
|
class ServerShowCommand < Command
|
25
25
|
|
26
|
-
def initialize(argv=[])
|
26
|
+
def initialize(argv = [])
|
27
27
|
super argv
|
28
28
|
# columns_with_info is array of hash with label, key and attribute extraction callback, ex [{:label => "Label text", :key => 'key', value_callback => callback_method to extract/format the required value}, ...]
|
29
29
|
@columns_with_info = []
|
@@ -36,7 +36,7 @@ class Chef
|
|
36
36
|
errors << "You must provide a valid Instance Id"
|
37
37
|
end
|
38
38
|
error_message = ""
|
39
|
-
raise CloudExceptions::ValidationError, error_message if errors.each{|e| ui.error(e); error_message = "#{error_message} #{e}."}.any?
|
39
|
+
raise CloudExceptions::ValidationError, error_message if errors.each { |e| ui.error(e); error_message = "#{error_message} #{e}." }.any?
|
40
40
|
end
|
41
41
|
|
42
42
|
def execute_command
|
@@ -1,5 +1,5 @@
|
|
1
1
|
#
|
2
|
-
# Copyright:: Copyright (c) 2013
|
2
|
+
# Copyright:: Copyright (c) 2013-2016 Chef Software, Inc.
|
3
3
|
# License:: Apache License, Version 2.0
|
4
4
|
#
|
5
5
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
@@ -23,14 +23,13 @@ class Chef
|
|
23
23
|
includer.class_eval do
|
24
24
|
|
25
25
|
option :instance_id,
|
26
|
-
:
|
27
|
-
:
|
28
|
-
:
|
29
|
-
|
26
|
+
long: "--instance-id INSTANCE_ID",
|
27
|
+
description: "Required. Instance Id of Server",
|
28
|
+
proc: Proc.new { |i| Chef::Config[:knife][:instance_id] = i }
|
29
|
+
|
30
30
|
end
|
31
31
|
end
|
32
32
|
end
|
33
33
|
end
|
34
34
|
end
|
35
35
|
end
|
36
|
-
|
@@ -1,6 +1,6 @@
|
|
1
1
|
#
|
2
2
|
# Author:: Kaustubh Deorukhkar (<kaustubh@clogeny.com>)
|
3
|
-
# Copyright:: Copyright (c) 2013
|
3
|
+
# Copyright:: Copyright (c) 2013-2016 Chef Software, Inc.
|
4
4
|
# License:: Apache License, Version 2.0
|
5
5
|
#
|
6
6
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
@@ -16,7 +16,7 @@
|
|
16
16
|
# limitations under the License.
|
17
17
|
#
|
18
18
|
|
19
|
-
require
|
19
|
+
require "chef/knife/cloud/exceptions"
|
20
20
|
require "chef/knife/cloud/helpers"
|
21
21
|
|
22
22
|
class Chef
|
@@ -32,7 +32,7 @@ class Chef
|
|
32
32
|
|
33
33
|
def connection
|
34
34
|
# Fog or cloud specific connection object must be created in derived.
|
35
|
-
raise Chef::Exceptions::Override, "You must override connection in #{self
|
35
|
+
raise Chef::Exceptions::Override, "You must override connection in #{self}"
|
36
36
|
end
|
37
37
|
|
38
38
|
# override in cloud specific derived classes
|
@@ -48,44 +48,43 @@ class Chef
|
|
48
48
|
end
|
49
49
|
|
50
50
|
def delete_server_on_failure(server = nil)
|
51
|
-
raise Chef::Exceptions::Override, "You must override delete_server_on_failure in #{self
|
51
|
+
raise Chef::Exceptions::Override, "You must override delete_server_on_failure in #{self} to delete server"
|
52
52
|
end
|
53
53
|
|
54
54
|
# cloud server specific implementation methods for commands.
|
55
55
|
def create_server(options = {})
|
56
|
-
raise Chef::Exceptions::Override, "You must override create_server in #{self
|
56
|
+
raise Chef::Exceptions::Override, "You must override create_server in #{self}"
|
57
57
|
end
|
58
58
|
|
59
59
|
def delete_server(server_name)
|
60
|
-
raise Chef::Exceptions::Override, "You must override delete_server in #{self
|
60
|
+
raise Chef::Exceptions::Override, "You must override delete_server in #{self}"
|
61
61
|
end
|
62
62
|
|
63
63
|
def list_servers
|
64
|
-
raise Chef::Exceptions::Override, "You must override list_servers in #{self
|
64
|
+
raise Chef::Exceptions::Override, "You must override list_servers in #{self}"
|
65
65
|
end
|
66
66
|
|
67
67
|
def list_images(image_filters)
|
68
|
-
raise Chef::Exceptions::Override, "You must override list_images in #{self
|
68
|
+
raise Chef::Exceptions::Override, "You must override list_images in #{self}"
|
69
69
|
end
|
70
70
|
|
71
71
|
def list_resource_configurations
|
72
|
-
raise Chef::Exceptions::Override, "You must override list_resource_configurations in #{self
|
72
|
+
raise Chef::Exceptions::Override, "You must override list_resource_configurations in #{self}"
|
73
73
|
end
|
74
74
|
|
75
75
|
def get_server(server_name)
|
76
|
-
raise Chef::Exceptions::Override, "You must override get_server in #{self
|
76
|
+
raise Chef::Exceptions::Override, "You must override get_server in #{self}"
|
77
77
|
end
|
78
78
|
|
79
79
|
def server_summary(server, columns_with_info = [])
|
80
|
-
raise Chef::Exceptions::Override, "You must override server_summary in #{self
|
80
|
+
raise Chef::Exceptions::Override, "You must override server_summary in #{self}"
|
81
81
|
end
|
82
82
|
|
83
83
|
def add_custom_attributes(server_def)
|
84
|
-
Chef::Config[:knife][:custom_attributes].map{|args| args.map{|k,v| server_def.merge!(k.to_sym => v)}} unless Chef::Config[:knife][:custom_attributes].nil?
|
84
|
+
Chef::Config[:knife][:custom_attributes].map { |args| args.map { |k, v| server_def.merge!(k.to_sym => v) } } unless Chef::Config[:knife][:custom_attributes].nil?
|
85
85
|
end
|
86
86
|
|
87
87
|
end # class service
|
88
88
|
end
|
89
89
|
end
|
90
90
|
end
|
91
|
-
|
data/lib/knife-cloud/version.rb
CHANGED
data/lib/test/fixtures/knife.rb
CHANGED
@@ -4,6 +4,6 @@ client_key "#{current_dir}/validation.pem"
|
|
4
4
|
validation_client_name "validation"
|
5
5
|
validation_key "#{current_dir}/validation.pem"
|
6
6
|
chef_server_url "http://localhost:8889"
|
7
|
-
cache_type
|
8
|
-
cache_options( :
|
9
|
-
cookbook_path
|
7
|
+
cache_type "BasicFile"
|
8
|
+
cache_options( path: "#{ENV['HOME']}/.chef/checksums" )
|
9
|
+
cookbook_path ["#{current_dir}/chef-repo/cookbooks"]
|
@@ -0,0 +1,27 @@
|
|
1
|
+
-----BEGIN RSA PRIVATE KEY-----
|
2
|
+
MIIEogIBAAKCAQEA7TfhToresZudM5gaBfzM/eHrGuJtN8uMaG51fLk9rNVwOxIw
|
3
|
+
eb9AmWJSQgftRj4AJSnt8Jv+QyAafjg79rEmCpd2K+toN1fXiVsf/ld/VdMI5vCd
|
4
|
+
usJc8aC4OFIVrLetm9eq+joXiCSLfEYP1w4d1gc9wqr54rnGVgQdWv31NhqXX7Tl
|
5
|
+
2bHRoEsfIFM7Vr5zC9Rv6XEtrwezSpzQ+ru707UOCOHNnH1TDxNDz+L71xJnGXD6
|
6
|
+
uh596hVm2GiXJ8lyCVJTs/RZ+HKtRuxYOJztdCQAXbd6DDjTBax/cCEzzoxK/LMc
|
7
|
+
1K/zWCKN8yM/XpiFqNuBB0yrqS5Y4zlROY0ssQIDAQABAoIBAQDmC1HYvD1YGePq
|
8
|
+
O+/IrK8S6jr4WGq4OBIS2EPhTzbrXBU5g9s0xe7ckIfa9xr4CnpTkATqWCzMZd6r
|
9
|
+
Vtd31bVhgh6cWu829F3WG2O8YJfg4AX7B46+pWxC+qyMGbZhR8L5pb1ualWVtnL6
|
10
|
+
cms8D7mJbH5NQUeRwrz/f4AEVNGuw165PhglXnRq3zxs97jdNH6av0na1VLAmUeR
|
11
|
+
vmYToLoIsK5yLeNzMfRRrQkq4ndUvad2ahqsz+p/xUjfYneBz4uujE/PcCgi423Q
|
12
|
+
FMH1NtPpzmuZuABU53wUMW4BXsSGv+34UMhRTazcBPRBYjKT6l6F7Tt9wPFxrtVn
|
13
|
+
KYI9dI0tAoGBAPzBwLsUuyEJtSd2zW63f7EhhG/2rSBm1g9Bcs1sHZtXIX3JN51X
|
14
|
+
hd+ckXQcLgQYn8syGW1+WcuaHGyp7v3G0yr6b38FWwEnmD85Mq5da1dyio2udBdK
|
15
|
+
Xm8MfY94yP8qSH3bUDKEl+cV9X5rtzbQAorMXb/Qkc4vErWfABVBKeLPAoGBAPBD
|
16
|
+
FjGxER9YU4hFV2vn5qElfxa799Vl0uSvao0lSkTpA/sHFxAkRQc/mo1PBClaH0ba
|
17
|
+
Hqr141o5pGUDgLqpO3kEY5vYBOaFXLFdFCcL+1YUR6t0bX+WCHuq21Cs6Gu4+qNA
|
18
|
+
D4dpsSPDXfatyXWM5PF2d4FwO2XnL25Yt+rg6dh/AoGAbEfk9UCQWjr6bImswH3E
|
19
|
+
KnIddonK6VKk6aw0LmTe2imdo3GMbc+M/prohUF9RSv3aOlxk0LJ3TuMadDzHa0L
|
20
|
+
0iGvmk8FCZ2Yz50FZUWIMtJTIRdXjJLDmfdT4x7vnMDUhXZrCPlcyhbSMPKcbtL2
|
21
|
+
A9hBYWdMz3PDJCOVuYVNGGkCgYEAhSxKUwTYfs1Qj8oPqOoDdfL4vLs3pfsoqEVr
|
22
|
+
BA1VW1jlMfE+IV5ZPKlOm2De56TijT09nnloqYwlyS/l3JENPAjoxWs5XCUzucPj
|
23
|
+
9bi4eYAIMcr5Hq0kypdrtQ4CTiNcGbzaXq6A11fk72RotFWCWSzXFNIGuncoXTuj
|
24
|
+
xfcg5zUCf3TQrwpcBB1Hf9hm6lUVpptvUZJAQtkWoaWXUPRY0CjcVdDc5ak4xqL2
|
25
|
+
FcAuJwV95b3qLyPESJ8zUBLOg3DcT1X9mrvRuKgC/Ie6k4R+oxU/nXi4vsPXlvg4
|
26
|
+
yap6MUYSjPOa7eCrhg2zFZiqO6VLEogPc1nsjb9Zl2UWLLYyCVz=
|
27
|
+
-----END RSA PRIVATE KEY-----
|
@@ -1,8 +1,8 @@
|
|
1
1
|
require "securerandom"
|
2
|
-
require
|
3
|
-
require
|
4
|
-
require File.expand_path(File.dirname(__FILE__) +
|
5
|
-
require File.expand_path(File.dirname(__FILE__) +
|
2
|
+
require "tmpdir"
|
3
|
+
require "fileutils"
|
4
|
+
require File.expand_path(File.dirname(__FILE__) + "/knife_test_utils")
|
5
|
+
require File.expand_path(File.dirname(__FILE__) + "/matchers")
|
6
6
|
|
7
7
|
module KnifeTestHelper
|
8
8
|
extend RSpec::KnifeTestUtils
|
@@ -12,28 +12,28 @@ module KnifeTestHelper
|
|
12
12
|
|
13
13
|
def match_status(test_run_expect)
|
14
14
|
if "#{test_run_expect}" == "should fail"
|
15
|
-
should_not have_outcome :
|
15
|
+
should_not have_outcome status: 0
|
16
16
|
elsif "#{test_run_expect}" == "should succeed"
|
17
|
-
should have_outcome :
|
17
|
+
should have_outcome status: 0
|
18
18
|
elsif "#{test_run_expect}" == "should return empty list"
|
19
|
-
should have_outcome :
|
19
|
+
should have_outcome status: 0
|
20
20
|
else
|
21
|
-
should have_outcome :
|
21
|
+
should have_outcome status: 0
|
22
22
|
end
|
23
23
|
end
|
24
24
|
|
25
25
|
def match_stdout(test_run_expect)
|
26
|
-
should have_outcome :
|
26
|
+
should have_outcome stdout: test_run_expect
|
27
27
|
end
|
28
28
|
|
29
29
|
def create_file(file_dir, file_name, data_to_write_file_path)
|
30
30
|
puts "Creating: #{file_name}"
|
31
31
|
begin
|
32
32
|
data_to_write = File.read(File.expand_path("#{data_to_write_file_path}", __FILE__))
|
33
|
-
File.open("#{file_dir}/#{file_name}",
|
33
|
+
File.open("#{file_dir}/#{file_name}", "w") { |f| f.write(data_to_write) }
|
34
34
|
rescue
|
35
35
|
puts "Error while creating file - #{file_name}"
|
36
36
|
end
|
37
37
|
end
|
38
|
-
|
38
|
+
|
39
39
|
end
|
@@ -1,4 +1,4 @@
|
|
1
|
-
require
|
1
|
+
require "mixlib/shellout"
|
2
2
|
|
3
3
|
module RSpec
|
4
4
|
module KnifeTestUtils
|
@@ -7,11 +7,11 @@ module RSpec
|
|
7
7
|
base.class_eval do
|
8
8
|
subject { knife_run }
|
9
9
|
let(:knife_run) { run command }
|
10
|
-
let(:command) {
|
10
|
+
let(:command) { raise "Define let(:command) in the spec" }
|
11
11
|
let(:cmd_output) { @op }
|
12
12
|
end
|
13
13
|
end
|
14
|
-
|
14
|
+
|
15
15
|
# Convenience method for actually running a knife command in our
|
16
16
|
# testing repository. Returns the Mixlib::Shellout object ready for
|
17
17
|
# inspection.
|
@@ -20,7 +20,7 @@ module RSpec
|
|
20
20
|
shell_out.timeout = 3000
|
21
21
|
shell_out.tap(&:run_command)
|
22
22
|
@op = shell_out.exitstatus == 1 ? shell_out.stderr : shell_out.stdout
|
23
|
-
|
23
|
+
shell_out
|
24
24
|
end
|
25
25
|
|
26
26
|
def knife(knife_command)
|
@@ -1,9 +1,9 @@
|
|
1
|
-
require
|
2
|
-
require File.expand_path(File.dirname(__FILE__) +
|
1
|
+
require "rspec"
|
2
|
+
require File.expand_path(File.dirname(__FILE__) + "/knife_test_utils")
|
3
3
|
|
4
4
|
RSpec::Matchers.define :have_outcome do |outcome_spec|
|
5
5
|
match do |executed_shellout_command|
|
6
|
-
valid_keys =
|
6
|
+
valid_keys = [:status, :stdout, :stderr]
|
7
7
|
if outcome_spec.keys & valid_keys == []
|
8
8
|
throw "You did not specify values for any of #{valid_keys}!"
|
9
9
|
end
|
@@ -1,4 +1,4 @@
|
|
1
|
-
# Copyright: Copyright (c) 2012
|
1
|
+
# Copyright: Copyright (c) 2012-2016 Chef Software, Inc.
|
2
2
|
# License: Apache License, Version 2.0
|
3
3
|
#
|
4
4
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
@@ -15,42 +15,42 @@
|
|
15
15
|
|
16
16
|
# Author:: Ameya Varade (<ameya.varade@clogeny.com>)
|
17
17
|
|
18
|
-
require File.expand_path(File.dirname(__FILE__) +
|
18
|
+
require File.expand_path(File.dirname(__FILE__) + "/helper")
|
19
19
|
|
20
20
|
module KnifeTestBed
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
end
|
21
|
+
include KnifeTestHelper
|
22
|
+
def init_test
|
23
|
+
puts "\nCreating Test Data\n"
|
24
|
+
create_file("#{temp_dir}", "validation.pem", "../../fixtures/validation.pem" )
|
25
|
+
create_file("#{temp_dir}", "knife.rb", "../../fixtures/knife.rb")
|
26
|
+
create_file("#{temp_dir}", "chef-full-chef-zero.erb", "../../templates/chef-full-chef-zero.erb")
|
27
|
+
create_file("#{temp_dir}", "windows-chef-client-msi.erb", "../../templates/windows-chef-client-msi.erb")
|
28
|
+
create_file("#{temp_dir}", "windows-shell.erb", "../../templates/windows-shell.erb")
|
29
|
+
end
|
30
|
+
|
31
|
+
def cleanup_test_data
|
32
|
+
puts "\nCleaning Test Data\n"
|
33
|
+
FileUtils.rm_rf("#{temp_dir}")
|
34
|
+
puts "\nDone\n"
|
35
|
+
end
|
36
|
+
|
37
|
+
def get_knife_rb_path
|
38
|
+
"#{temp_dir}/" + "knife.rb"
|
39
|
+
end
|
40
|
+
|
41
|
+
def get_validation_pem_path
|
42
|
+
"#{temp_dir}/" + "validation.pem"
|
43
|
+
end
|
44
|
+
|
45
|
+
def get_linux_template_file_path
|
46
|
+
"#{temp_dir}/" + "chef-full-chef-zero.erb"
|
47
|
+
end
|
48
|
+
|
49
|
+
def get_windows_msi_template_file_path
|
50
|
+
"#{temp_dir}/" + "windows-chef-client-msi.erb"
|
51
|
+
end
|
52
|
+
|
53
|
+
def get_windows_shell_template_file_path
|
54
|
+
"#{temp_dir}/" + "windows-shell.erb"
|
55
|
+
end
|
56
|
+
end
|
@@ -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");
|
@@ -107,7 +107,7 @@ goto install
|
|
107
107
|
:install
|
108
108
|
@rem Install Chef using chef-client MSI installer
|
109
109
|
|
110
|
-
<% url="https://www.
|
110
|
+
<% url="https://www.chef.io/chef/download?p=windows&pv=%MACHINE_OS%&m=%MACHINE_ARCH%" -%>
|
111
111
|
<% url += "&v=#{@config[:bootstrap_version]}" if @config.key? :bootstrap_version -%>
|
112
112
|
@set "REMOTE_SOURCE_MSI_URL=<%= url %>"
|
113
113
|
@set "LOCAL_DESTINATION_MSI_PATH=<%= local_download_path %>"
|
@@ -228,4 +228,3 @@ C:\opscode\chef\embedded\bin\ruby C:\chef_zero_startup.rb
|
|
228
228
|
|
229
229
|
@echo Starting chef to bootstrap the node...
|
230
230
|
<%= start_chef %>
|
231
|
-
|