itamae-mitsurin 0.50 → 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/lib/itamae-mitsurin/cli.rb +0 -2
- data/lib/itamae-mitsurin/logger.rb +74 -20
- data/lib/itamae-mitsurin/mitsurin/base.rb +109 -0
- data/lib/itamae-mitsurin/mitsurin/base_task.rb +147 -0
- data/lib/itamae-mitsurin/mitsurin/creators/templates/project/site-cookbooks/_base/_base/recipes/default.rb +0 -11
- data/lib/itamae-mitsurin/mitsurin/itamae_task.rb +44 -130
- data/lib/itamae-mitsurin/mitsurin/itamae_with_target_task.rb +64 -157
- data/lib/itamae-mitsurin/mitsurin/local_task.rb +57 -131
- data/lib/itamae-mitsurin/mitsurin/serverspec_task.rb +56 -81
- data/lib/itamae-mitsurin/mitsurin/serverspec_with_target_task.rb +80 -143
- data/lib/itamae-mitsurin/node.rb +0 -1
- data/lib/itamae-mitsurin/notification.rb +0 -1
- data/lib/itamae-mitsurin/recipe.rb +2 -5
- data/lib/itamae-mitsurin/resource.rb +1 -1
- data/lib/itamae-mitsurin/resource/base.rb +0 -12
- data/lib/itamae-mitsurin/resource/http_request.rb +23 -8
- data/lib/itamae-mitsurin/resource/s3_file.rb +33 -0
- data/lib/itamae-mitsurin/runner.rb +4 -5
- data/lib/itamae-mitsurin/version.txt +1 -1
- metadata +6 -221
- data/lib/itamae-mitsurin/mitsurin/itamae_with_git_task.rb +0 -159
- data/lib/itamae-mitsurin/mitsurin/task_base.rb +0 -100
- data/test/test_itamae-mitsurin.rb +0 -18
- data/test/test_itamae-mitsurin/ext/test_specinfra.rb +0 -39
- data/test/test_itamae-mitsurin/handler/test_base.rb +0 -40
- data/test/test_itamae-mitsurin/handler/test_debug.rb +0 -10
- data/test/test_itamae-mitsurin/handler/test_fluentd.rb +0 -44
- data/test/test_itamae-mitsurin/handler/test_json.rb +0 -22
- data/test/test_itamae-mitsurin/mitsurin/creators/templates/project/.rspec +0 -2
- data/test/test_itamae-mitsurin/mitsurin/creators/templates/project/Gemfile +0 -3
- data/test/test_itamae-mitsurin/mitsurin/creators/templates/project/Rakefile +0 -2
- data/test/test_itamae-mitsurin/mitsurin/creators/templates/project/environments/.keep +0 -0
- data/test/test_itamae-mitsurin/mitsurin/creators/templates/project/environments/sample.json +0 -7
- data/test/test_itamae-mitsurin/mitsurin/creators/templates/project/keys/.keep +0 -0
- data/test/test_itamae-mitsurin/mitsurin/creators/templates/project/nodes/.keep +0 -0
- data/test/test_itamae-mitsurin/mitsurin/creators/templates/project/nodes/sample01.json +0 -9
- data/test/test_itamae-mitsurin/mitsurin/creators/templates/project/roles/.keep +0 -0
- data/test/test_itamae-mitsurin/mitsurin/creators/templates/project/site-cookbooks/_base/_base/attributes/.keep +0 -0
- data/test/test_itamae-mitsurin/mitsurin/creators/templates/project/site-cookbooks/_base/_base/files/.keep +0 -0
- data/test/test_itamae-mitsurin/mitsurin/creators/templates/project/site-cookbooks/_base/_base/recipes/default.rb +0 -1
- data/test/test_itamae-mitsurin/mitsurin/creators/templates/project/site-cookbooks/_base/_base/spec/default_spec.rb +0 -1
- data/test/test_itamae-mitsurin/mitsurin/creators/templates/project/site-cookbooks/_base/_base/templates/.keep +0 -0
- data/test/test_itamae-mitsurin/mitsurin/creators/templates/project/spec/spec_helper.rb +0 -33
- data/test/test_itamae-mitsurin/mitsurin/creators/templates/project/tmp-nodes/.keep +0 -0
- data/test/test_itamae-mitsurin/mitsurin/creators/templates/site-cookbooks/attributes/.keep +0 -0
- data/test/test_itamae-mitsurin/mitsurin/creators/templates/site-cookbooks/files/.keep +0 -0
- data/test/test_itamae-mitsurin/mitsurin/creators/templates/site-cookbooks/recipes/default.rb +0 -0
- data/test/test_itamae-mitsurin/mitsurin/creators/templates/site-cookbooks/spec/.keep +0 -0
- data/test/test_itamae-mitsurin/mitsurin/creators/templates/site-cookbooks/templates/.keep +0 -0
- data/test/test_itamae-mitsurin/mitsurin/creators/test_cookbook.rb +0 -24
- data/test/test_itamae-mitsurin/mitsurin/creators/test_project.rb +0 -24
- data/test/test_itamae-mitsurin/mitsurin/test_cli.rb +0 -56
- data/test/test_itamae-mitsurin/mitsurin/test_creators.rb +0 -19
- data/test/test_itamae-mitsurin/mitsurin/test_itamae_task.rb +0 -197
- data/test/test_itamae-mitsurin/mitsurin/test_itamae_with_git_task.rb +0 -213
- data/test/test_itamae-mitsurin/mitsurin/test_serverspec_task.rb +0 -123
- data/test/test_itamae-mitsurin/resource/test_aws_ebs_volume.rb +0 -84
- data/test/test_itamae-mitsurin/resource/test_base.rb +0 -374
- data/test/test_itamae-mitsurin/resource/test_directory.rb +0 -63
- data/test/test_itamae-mitsurin/resource/test_execute.rb +0 -26
- data/test/test_itamae-mitsurin/resource/test_file.rb +0 -176
- data/test/test_itamae-mitsurin/resource/test_gem_package.rb +0 -81
- data/test/test_itamae-mitsurin/resource/test_git.rb +0 -94
- data/test/test_itamae-mitsurin/resource/test_group.rb +0 -42
- data/test/test_itamae-mitsurin/resource/test_http_request.rb +0 -71
- data/test/test_itamae-mitsurin/resource/test_link.rb +0 -33
- data/test/test_itamae-mitsurin/resource/test_local_ruby_block.rb +0 -15
- data/test/test_itamae-mitsurin/resource/test_package.rb +0 -44
- data/test/test_itamae-mitsurin/resource/test_remote_directory.rb +0 -84
- data/test/test_itamae-mitsurin/resource/test_remote_file.rb +0 -54
- data/test/test_itamae-mitsurin/resource/test_service.rb +0 -69
- data/test/test_itamae-mitsurin/resource/test_template.rb +0 -53
- data/test/test_itamae-mitsurin/resource/test_user.rb +0 -93
- data/test/test_itamae-mitsurin/test_backend.rb +0 -297
- data/test/test_itamae-mitsurin/test_cli.rb +0 -88
- data/test/test_itamae-mitsurin/test_definition.rb +0 -40
- data/test/test_itamae-mitsurin/test_ext.rb +0 -1
- data/test/test_itamae-mitsurin/test_handler.rb +0 -21
- data/test/test_itamae-mitsurin/test_handler_proxy.rb +0 -38
- data/test/test_itamae-mitsurin/test_logger.rb +0 -124
- data/test/test_itamae-mitsurin/test_mitsurin.rb +0 -14
- data/test/test_itamae-mitsurin/test_node.rb +0 -74
- data/test/test_itamae-mitsurin/test_notification.rb +0 -46
- data/test/test_itamae-mitsurin/test_recipe.rb +0 -171
- data/test/test_itamae-mitsurin/test_recipe_children.rb +0 -86
- data/test/test_itamae-mitsurin/test_resource.rb +0 -73
- data/test/test_itamae-mitsurin/test_runner.rb +0 -124
- data/test/test_itamae-mitsurin/test_version.rb +0 -3
- data/test/test_itamae-mitsurin/version.txt +0 -1
- data/test_project/.rspec +0 -2
- data/test_project/Gemfile +0 -4
- data/test_project/Rakefile +0 -3
- data/test_project/environments/.keep +0 -0
- data/test_project/keys/.keep +0 -0
- data/test_project/nodes/.keep +0 -0
- data/test_project/nodes/test.json +0 -9
- data/test_project/roles/.keep +0 -0
- data/test_project/roles/test.json +0 -14
- data/test_project/site-cookbooks/_base/_base/attributes/.keep +0 -0
- data/test_project/site-cookbooks/_base/_base/files/.keep +0 -0
- data/test_project/site-cookbooks/_base/_base/recipes/default.rb +0 -1
- data/test_project/site-cookbooks/_base/_base/spec/default_spec.rb +0 -1
- data/test_project/site-cookbooks/_base/_base/templates/.keep +0 -0
- data/test_project/site-cookbooks/a_test/directory/attributes/.keep +0 -0
- data/test_project/site-cookbooks/a_test/directory/files/.keep +0 -0
- data/test_project/site-cookbooks/a_test/directory/recipes/default.rb +0 -8
- data/test_project/site-cookbooks/a_test/directory/spec/.keep +0 -0
- data/test_project/site-cookbooks/a_test/directory/spec/default_spec.rb +0 -4
- data/test_project/site-cookbooks/a_test/directory/templates/.keep +0 -0
- data/test_project/site-cookbooks/a_test/package/attributes/.keep +0 -0
- data/test_project/site-cookbooks/a_test/package/files/.keep +0 -0
- data/test_project/site-cookbooks/a_test/package/recipes/default.rb +0 -2
- data/test_project/site-cookbooks/a_test/package/spec/.keep +0 -0
- data/test_project/site-cookbooks/a_test/package/spec/default_spec.rb +0 -4
- data/test_project/site-cookbooks/a_test/package/templates/.keep +0 -0
- data/test_project/site-cookbooks/a_test/service/attributes/.keep +0 -0
- data/test_project/site-cookbooks/a_test/service/files/.keep +0 -0
- data/test_project/site-cookbooks/a_test/service/recipes/default.rb +0 -5
- data/test_project/site-cookbooks/a_test/service/spec/.keep +0 -0
- data/test_project/site-cookbooks/a_test/service/spec/default_spec.rb +0 -6
- data/test_project/site-cookbooks/a_test/service/templates/.keep +0 -0
- data/test_project/site-cookbooks/b_test/git/attributes/.keep +0 -0
- data/test_project/site-cookbooks/b_test/git/files/.keep +0 -0
- data/test_project/site-cookbooks/b_test/git/recipes/default.rb +0 -5
- data/test_project/site-cookbooks/b_test/git/spec/.keep +0 -0
- data/test_project/site-cookbooks/b_test/git/spec/default_spec.rb +0 -5
- data/test_project/site-cookbooks/b_test/git/templates/.keep +0 -0
- data/test_project/site-cookbooks/b_test/link/attributes/.keep +0 -0
- data/test_project/site-cookbooks/b_test/link/files/.keep +0 -0
- data/test_project/site-cookbooks/b_test/link/recipes/default.rb +0 -5
- data/test_project/site-cookbooks/b_test/link/spec/.keep +0 -0
- data/test_project/site-cookbooks/b_test/link/spec/default_spec.rb +0 -5
- data/test_project/site-cookbooks/b_test/link/templates/.keep +0 -0
- data/test_project/site-cookbooks/b_test/remote_file/attributes/.keep +0 -0
- data/test_project/site-cookbooks/b_test/remote_file/files/.keep +0 -0
- data/test_project/site-cookbooks/b_test/remote_file/files/remote_file.sh +0 -1
- data/test_project/site-cookbooks/b_test/remote_file/recipes/default.rb +0 -9
- data/test_project/site-cookbooks/b_test/remote_file/spec/.keep +0 -0
- data/test_project/site-cookbooks/b_test/remote_file/spec/default_spec.rb +0 -7
- data/test_project/site-cookbooks/b_test/remote_file/templates/.keep +0 -0
- data/test_project/site-cookbooks/b_test/template/attributes/.keep +0 -0
- data/test_project/site-cookbooks/b_test/template/files/.keep +0 -0
- data/test_project/site-cookbooks/b_test/template/recipes/default.rb +0 -5
- data/test_project/site-cookbooks/b_test/template/spec/.keep +0 -0
- data/test_project/site-cookbooks/b_test/template/spec/default_spec.rb +0 -7
- data/test_project/site-cookbooks/b_test/template/templates/.keep +0 -0
- data/test_project/site-cookbooks/b_test/template/templates/template.erb +0 -2
- data/test_project/site-cookbooks/c_test/execute/attributes/.keep +0 -0
- data/test_project/site-cookbooks/c_test/execute/files/.keep +0 -0
- data/test_project/site-cookbooks/c_test/execute/recipes/default.rb +0 -6
- data/test_project/site-cookbooks/c_test/execute/spec/.keep +0 -0
- data/test_project/site-cookbooks/c_test/execute/spec/default_spec.rb +0 -6
- data/test_project/site-cookbooks/c_test/execute/templates/.keep +0 -0
- data/test_project/site-cookbooks/c_test/remote_directory/attributes/.keep +0 -0
- data/test_project/site-cookbooks/c_test/remote_directory/files/.keep +0 -0
- data/test_project/site-cookbooks/c_test/remote_directory/recipes/default.rb +0 -10
- data/test_project/site-cookbooks/c_test/remote_directory/spec/.keep +0 -0
- data/test_project/site-cookbooks/c_test/remote_directory/spec/default_spec.rb +0 -20
- data/test_project/site-cookbooks/c_test/remote_directory/templates/.keep +0 -0
- data/test_project/site-cookbooks/c_test/remote_directory/templates/remote_dir/a.txt +0 -0
- data/test_project/site-cookbooks/c_test/remote_directory/templates/remote_dir/b.txt +0 -0
- data/test_project/site-cookbooks/c_test/remote_directory/templates/remote_dir/c.txt +0 -0
- data/test_project/site-cookbooks/d_spec/air/attributes/.keep +0 -0
- data/test_project/site-cookbooks/d_spec/air/files/.keep +0 -0
- data/test_project/site-cookbooks/d_spec/air/recipes/default.rb +0 -0
- data/test_project/site-cookbooks/d_spec/air/spec/.keep +0 -0
- data/test_project/site-cookbooks/d_spec/air/spec/default_spec.rb +0 -0
- data/test_project/site-cookbooks/d_spec/air/templates/.keep +0 -0
- data/test_project/spec/spec_helper.rb +0 -33
- data/test_project/tmp-nodes/.keep +0 -0
- data/test_project/tmp-nodes/test.json +0 -12
@@ -1,86 +0,0 @@
|
|
1
|
-
module ItamaeMitsurin
|
2
|
-
class RecipeChildren < Array
|
3
|
-
NotFoundError = Class.new(StandardError)
|
4
|
-
|
5
|
-
def find_resource_by_description(desc)
|
6
|
-
# desc is like 'resource_type[name]'
|
7
|
-
resources.find do |resource|
|
8
|
-
type, name = ItamaeMitsurin::Resource.parse_description(desc)
|
9
|
-
resource.resource_type == type && resource.resource_name == name
|
10
|
-
end.tap do |resource|
|
11
|
-
unless resource
|
12
|
-
raise NotFoundError, "'#{desc}' resource is not found."
|
13
|
-
end
|
14
|
-
end
|
15
|
-
end
|
16
|
-
|
17
|
-
def subscribing(target)
|
18
|
-
resources.map do |resource|
|
19
|
-
resource.subscriptions.select do |subscription|
|
20
|
-
subscription.resource == target
|
21
|
-
end
|
22
|
-
end.flatten
|
23
|
-
end
|
24
|
-
|
25
|
-
def find_recipe_by_path(path)
|
26
|
-
recipes.find do |recipe|
|
27
|
-
recipe.path == path
|
28
|
-
end
|
29
|
-
end
|
30
|
-
|
31
|
-
def resources
|
32
|
-
self.map do |item|
|
33
|
-
case item
|
34
|
-
when Resource::Base
|
35
|
-
item
|
36
|
-
when Recipe
|
37
|
-
item.children.resources
|
38
|
-
end
|
39
|
-
end.flatten
|
40
|
-
end
|
41
|
-
|
42
|
-
def recipes(options = {})
|
43
|
-
options = {recursive: true}.merge(options)
|
44
|
-
|
45
|
-
self.select do |item|
|
46
|
-
item.is_a?(Recipe)
|
47
|
-
end.map do |recipe|
|
48
|
-
if options[:recursive]
|
49
|
-
[recipe] + recipe.children.recipes
|
50
|
-
else
|
51
|
-
recipe
|
52
|
-
end
|
53
|
-
end.flatten
|
54
|
-
end
|
55
|
-
|
56
|
-
def run
|
57
|
-
self.each do |resource|
|
58
|
-
resource.run
|
59
|
-
end
|
60
|
-
end
|
61
|
-
|
62
|
-
# returns dependencies graph in DOT
|
63
|
-
def dependency_in_dot
|
64
|
-
result = ""
|
65
|
-
result << "digraph recipes {\n"
|
66
|
-
result << " rankdir=LR;\n"
|
67
|
-
result << _dependency_in_dot
|
68
|
-
result << "}"
|
69
|
-
|
70
|
-
result
|
71
|
-
end
|
72
|
-
|
73
|
-
def _dependency_in_dot
|
74
|
-
result = ""
|
75
|
-
|
76
|
-
recipes(recursive: false).each do |recipe|
|
77
|
-
recipe.children.recipes(recursive: false).each do |child_recipe|
|
78
|
-
result << %{ "#{recipe.path}" -> "#{child_recipe.path}";\n}
|
79
|
-
end
|
80
|
-
result << recipe.children._dependency_in_dot
|
81
|
-
end
|
82
|
-
|
83
|
-
result
|
84
|
-
end
|
85
|
-
end
|
86
|
-
end
|
@@ -1,73 +0,0 @@
|
|
1
|
-
require 'itamae-mitsurin'
|
2
|
-
require 'itamae-mitsurin/mitsurin'
|
3
|
-
require 'itamae-mitsurin/resource/base'
|
4
|
-
require 'itamae-mitsurin/resource/file'
|
5
|
-
require 'itamae-mitsurin/resource/package'
|
6
|
-
require 'itamae-mitsurin/resource/remote_directory'
|
7
|
-
require 'itamae-mitsurin/resource/remote_file'
|
8
|
-
require 'itamae-mitsurin/resource/directory'
|
9
|
-
require 'itamae-mitsurin/resource/template'
|
10
|
-
require 'itamae-mitsurin/resource/http_request'
|
11
|
-
require 'itamae-mitsurin/resource/execute'
|
12
|
-
require 'itamae-mitsurin/resource/service'
|
13
|
-
require 'itamae-mitsurin/resource/link'
|
14
|
-
require 'itamae-mitsurin/resource/local_ruby_block'
|
15
|
-
require 'itamae-mitsurin/resource/git'
|
16
|
-
require 'itamae-mitsurin/resource/user'
|
17
|
-
require 'itamae-mitsurin/resource/group'
|
18
|
-
require 'itamae-mitsurin/resource/gem_package'
|
19
|
-
require 'itamae-mitsurin/resource/aws_ebs_volume'
|
20
|
-
|
21
|
-
module ItamaeMitsurin
|
22
|
-
module Resource
|
23
|
-
Error = Class.new(StandardError)
|
24
|
-
AttributeMissingError = Class.new(StandardError)
|
25
|
-
InvalidTypeError = Class.new(StandardError)
|
26
|
-
ParseError = Class.new(StandardError)
|
27
|
-
|
28
|
-
class << self
|
29
|
-
def to_camel_case(str)
|
30
|
-
str.split('_').map {|part| part.capitalize}.join
|
31
|
-
end
|
32
|
-
|
33
|
-
def get_resource_class(method)
|
34
|
-
begin
|
35
|
-
self.const_get(to_camel_case(method.to_s))
|
36
|
-
rescue NameError
|
37
|
-
begin
|
38
|
-
::ItamaeMitsurin::Plugin::Resource.const_get(to_camel_case(method.to_s))
|
39
|
-
rescue NameError
|
40
|
-
autoload_plugin_resource(method)
|
41
|
-
end
|
42
|
-
end
|
43
|
-
end
|
44
|
-
|
45
|
-
def autoload_plugin_resource(method)
|
46
|
-
begin
|
47
|
-
require "itamae/plugin/resource/#{method}"
|
48
|
-
::ItamaeMitsurin::Plugin::Resource.const_get(to_camel_case(method.to_s))
|
49
|
-
rescue LoadError, NameError
|
50
|
-
raise Error, "#{method} resource is missing."
|
51
|
-
end
|
52
|
-
end
|
53
|
-
|
54
|
-
def define_resource(name, klass)
|
55
|
-
class_name = to_camel_case(name.to_s)
|
56
|
-
if Resource.const_defined?(class_name)
|
57
|
-
ItamaeMitsurin.logger.warn "Redefine class. (#{class_name})"
|
58
|
-
return
|
59
|
-
end
|
60
|
-
|
61
|
-
Resource.const_set(class_name, klass)
|
62
|
-
end
|
63
|
-
|
64
|
-
def parse_description(desc)
|
65
|
-
if /\A([^\[]+)\[([^\]]+)\]\z/ =~ desc
|
66
|
-
[$1, $2]
|
67
|
-
else
|
68
|
-
raise ParseError, "'#{desc}' doesn't represent a resource."
|
69
|
-
end
|
70
|
-
end
|
71
|
-
end
|
72
|
-
end
|
73
|
-
end
|
@@ -1,124 +0,0 @@
|
|
1
|
-
require 'itamae-mitsurin'
|
2
|
-
require 'json'
|
3
|
-
require 'yaml'
|
4
|
-
|
5
|
-
module ItamaeMitsurin
|
6
|
-
class Runner
|
7
|
-
class << self
|
8
|
-
def run(recipe_files, backend_type, options)
|
9
|
-
ItamaeMitsurin.logger.info "Starting Itamae..."
|
10
|
-
|
11
|
-
backend = Backend.create(backend_type, options)
|
12
|
-
runner = self.new(backend, options)
|
13
|
-
runner.load_recipes(recipe_files)
|
14
|
-
runner.run
|
15
|
-
end
|
16
|
-
end
|
17
|
-
|
18
|
-
attr_reader :backend
|
19
|
-
attr_reader :options
|
20
|
-
attr_reader :node
|
21
|
-
attr_reader :tmpdir
|
22
|
-
attr_reader :children
|
23
|
-
attr_reader :handler
|
24
|
-
|
25
|
-
def initialize(backend, options)
|
26
|
-
@backend = backend
|
27
|
-
@options = options
|
28
|
-
|
29
|
-
prepare_handler
|
30
|
-
|
31
|
-
@node = create_node
|
32
|
-
@tmpdir = "/tmp/itamae_tmp"
|
33
|
-
@children = RecipeChildren.new
|
34
|
-
|
35
|
-
@backend.run_command(["mkdir", "-p", @tmpdir])
|
36
|
-
@backend.run_command(["chmod", "777", @tmpdir])
|
37
|
-
end
|
38
|
-
|
39
|
-
def load_recipes(paths)
|
40
|
-
paths.each do |path|
|
41
|
-
expanded_path = File.expand_path(path)
|
42
|
-
if path.include?('::')
|
43
|
-
gem_path = Recipe.find_recipe_in_gem(path)
|
44
|
-
expanded_path = gem_path if gem_path
|
45
|
-
end
|
46
|
-
|
47
|
-
recipe = Recipe.new(self, expanded_path)
|
48
|
-
children << recipe
|
49
|
-
recipe.load
|
50
|
-
end
|
51
|
-
end
|
52
|
-
|
53
|
-
def run
|
54
|
-
if recipe_graph_file = options[:recipe_graph]
|
55
|
-
save_dependency_graph(recipe_graph_file)
|
56
|
-
end
|
57
|
-
|
58
|
-
children.run
|
59
|
-
@backend.finalize
|
60
|
-
|
61
|
-
if profile = options[:profile]
|
62
|
-
save_profile(profile)
|
63
|
-
end
|
64
|
-
end
|
65
|
-
|
66
|
-
def dry_run?
|
67
|
-
@options[:dry_run]
|
68
|
-
end
|
69
|
-
|
70
|
-
def save_dependency_graph(path)
|
71
|
-
ItamaeMitsurin.logger.info "Writing recipe dependency graph to #{path}..."
|
72
|
-
open(path, 'w') do |f|
|
73
|
-
f.write(children.dependency_in_dot)
|
74
|
-
end
|
75
|
-
end
|
76
|
-
|
77
|
-
def save_profile(path)
|
78
|
-
open(path, 'w', 0600) do |f|
|
79
|
-
f.write(@backend.executed_commands.to_json)
|
80
|
-
end
|
81
|
-
end
|
82
|
-
|
83
|
-
private
|
84
|
-
def create_node
|
85
|
-
hash = {}
|
86
|
-
|
87
|
-
if @options[:ohai]
|
88
|
-
unless @backend.run_command("which ohai", error: false).exit_status == 0
|
89
|
-
# install Ohai
|
90
|
-
ItamaeMitsurin.logger.info "Installing Chef package... (to use Ohai)"
|
91
|
-
@backend.run_command("curl -L https://www.opscode.com/chef/install.sh | bash")
|
92
|
-
end
|
93
|
-
|
94
|
-
ItamaeMitsurin.logger.info "Loading node data via ohai..."
|
95
|
-
hash.merge!(JSON.parse(@backend.run_command("ohai").stdout))
|
96
|
-
end
|
97
|
-
|
98
|
-
if @options[:node_json]
|
99
|
-
path = File.expand_path(@options[:node_json])
|
100
|
-
ItamaeMitsurin.logger.info "Loading node data from #{path}..."
|
101
|
-
hash.merge!(JSON.load(open(path)))
|
102
|
-
end
|
103
|
-
|
104
|
-
if @options[:node_yaml]
|
105
|
-
path = File.expand_path(@options[:node_yaml])
|
106
|
-
ItamaeMitsurin.logger.info "Loading node data from #{path}..."
|
107
|
-
hash.merge!(YAML.load(open(path)) || {})
|
108
|
-
end
|
109
|
-
|
110
|
-
Node.new(hash, @backend)
|
111
|
-
end
|
112
|
-
|
113
|
-
def prepare_handler
|
114
|
-
@handler = HandlerProxy.new
|
115
|
-
(@options[:handlers] || []).each do |handler|
|
116
|
-
type = handler.delete('type')
|
117
|
-
unless type
|
118
|
-
raise "#{type} field is not set"
|
119
|
-
end
|
120
|
-
@handler.register_instance(Handler.from_type(type).new(handler))
|
121
|
-
end
|
122
|
-
end
|
123
|
-
end
|
124
|
-
end
|
@@ -1 +0,0 @@
|
|
1
|
-
0.4
|
data/test_project/.rspec
DELETED
data/test_project/Gemfile
DELETED
data/test_project/Rakefile
DELETED
File without changes
|
data/test_project/keys/.keep
DELETED
File without changes
|
data/test_project/nodes/.keep
DELETED
File without changes
|
data/test_project/roles/.keep
DELETED
File without changes
|
File without changes
|
File without changes
|
@@ -1 +0,0 @@
|
|
1
|
-
puts HighLine.new.color %! LOAD : Environment set is "#{node[:environments][:set]}"!, :green
|
@@ -1 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|