itamae 1.0.0.beta33 → 1.0.0.beta34
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/itamae/logger.rb +0 -8
- data/lib/itamae/resource/base.rb +15 -6
- data/lib/itamae/resource/directory.rb +7 -4
- data/lib/itamae/resource/file.rb +5 -4
- data/lib/itamae/resource/git.rb +1 -1
- data/lib/itamae/resource/link.rb +1 -1
- data/lib/itamae/resource/package.rb +7 -4
- data/lib/itamae/resource/service.rb +11 -11
- data/lib/itamae/version.txt +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 35649d044a624b2d15b00968214ab5a9bbdec57d
|
4
|
+
data.tar.gz: 5f221d3341a367ba33934195034f2b146f04d992
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a19fe887f749d27ca6f9b9c4eef51a974711f8a79257d2ec6cb8e41e177bd8ed37144a42ba652845a88465d7740a1e8d5641d1e508fcff09a13251152c5282be
|
7
|
+
data.tar.gz: e9fb236ceda5b1901c940053369a75cd37da70e1030a546e2f6a18d92ec49f72eadac7223d9b4221e990657f7f7e200768353a633c63ca9407f2e957db577e29
|
data/lib/itamae/logger.rb
CHANGED
data/lib/itamae/resource/base.rb
CHANGED
@@ -60,18 +60,27 @@ module Itamae
|
|
60
60
|
return
|
61
61
|
end
|
62
62
|
|
63
|
-
|
63
|
+
[action].flatten.each do |action|
|
64
|
+
@current_action = action
|
64
65
|
|
65
|
-
|
66
|
-
show_differences
|
66
|
+
Logger.info "action: #{action}"
|
67
67
|
|
68
|
-
|
69
|
-
[action].flatten.each do |action|
|
70
|
-
Logger.info "action: #{action}"
|
68
|
+
unless options[:dry_run]
|
71
69
|
Logger.formatter.indent do
|
70
|
+
Logger.debug "(in pre_action)"
|
71
|
+
pre_action
|
72
|
+
|
73
|
+
Logger.debug "(in set_current_attributes)"
|
74
|
+
set_current_attributes
|
75
|
+
|
76
|
+
Logger.debug "(in show_differences)"
|
77
|
+
show_differences
|
78
|
+
|
72
79
|
public_send("#{specific_action || action}_action".to_sym, options)
|
73
80
|
end
|
74
81
|
end
|
82
|
+
|
83
|
+
@current_action = nil
|
75
84
|
end
|
76
85
|
|
77
86
|
updated! if different?
|
@@ -9,6 +9,13 @@ module Itamae
|
|
9
9
|
define_attribute :owner, type: String
|
10
10
|
define_attribute :group, type: String
|
11
11
|
|
12
|
+
def pre_action
|
13
|
+
case @current_action
|
14
|
+
when :create
|
15
|
+
@attributes[:exist?] = true
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
12
19
|
def set_current_attributes
|
13
20
|
exist = run_specinfra(:check_file_is_directory, path)
|
14
21
|
@current_attributes[:exist?] = exist
|
@@ -22,10 +29,6 @@ module Itamae
|
|
22
29
|
@current_attributes[:owner] = nil
|
23
30
|
@current_attributes[:group] = nil
|
24
31
|
end
|
25
|
-
|
26
|
-
if action == :create
|
27
|
-
@attributes[:exist?] = true
|
28
|
-
end
|
29
32
|
end
|
30
33
|
|
31
34
|
def create_action(options)
|
data/lib/itamae/resource/file.rb
CHANGED
@@ -23,6 +23,11 @@ module Itamae
|
|
23
23
|
|
24
24
|
@temppath = ::File.join(runner.tmpdir, Time.now.to_f.to_s)
|
25
25
|
send_file(src, @temppath)
|
26
|
+
|
27
|
+
case @current_action
|
28
|
+
when :create
|
29
|
+
@attributes[:exist?] = true
|
30
|
+
end
|
26
31
|
end
|
27
32
|
|
28
33
|
def set_current_attributes
|
@@ -38,10 +43,6 @@ module Itamae
|
|
38
43
|
@current_attributes[:owner] = nil
|
39
44
|
@current_attributes[:group] = nil
|
40
45
|
end
|
41
|
-
|
42
|
-
if action == :create
|
43
|
-
@attributes[:exist?] = true
|
44
|
-
end
|
45
46
|
end
|
46
47
|
|
47
48
|
def show_differences
|
data/lib/itamae/resource/git.rb
CHANGED
data/lib/itamae/resource/link.rb
CHANGED
@@ -8,6 +8,13 @@ module Itamae
|
|
8
8
|
define_attribute :version, type: String
|
9
9
|
define_attribute :options, type: String
|
10
10
|
|
11
|
+
def pre_action
|
12
|
+
case @current_action
|
13
|
+
when :install
|
14
|
+
@attributes[:installed?] = true
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
11
18
|
def set_current_attributes
|
12
19
|
installed = run_specinfra(:check_package_is_installed, name)
|
13
20
|
@current_attributes[:installed?] = installed
|
@@ -15,10 +22,6 @@ module Itamae
|
|
15
22
|
if installed
|
16
23
|
@current_attributes[:version] = run_specinfra(:get_package_version, name).stdout.strip
|
17
24
|
end
|
18
|
-
|
19
|
-
if action == :install
|
20
|
-
@attributes[:installed?] = true
|
21
|
-
end
|
22
25
|
end
|
23
26
|
|
24
27
|
def install_action(action_options)
|
@@ -6,24 +6,24 @@ module Itamae
|
|
6
6
|
define_attribute :action, default: :nothing
|
7
7
|
define_attribute :name, type: String, default_name: true
|
8
8
|
|
9
|
-
def
|
10
|
-
@
|
11
|
-
|
12
|
-
|
13
|
-
actions = [action].flatten
|
14
|
-
if actions.include?(:start) || actions.include?(:restart)
|
9
|
+
def pre_action
|
10
|
+
case @current_action
|
11
|
+
when :start, :restart
|
15
12
|
@attributes[:running?] = true
|
16
|
-
|
13
|
+
when :stop
|
17
14
|
@attributes[:running?] = false
|
18
|
-
|
19
|
-
|
20
|
-
if actions.include?(:enable)
|
15
|
+
when :enable
|
21
16
|
@attributes[:enabled?] = true
|
22
|
-
|
17
|
+
when :disable
|
23
18
|
@attributes[:enabled?] = false
|
24
19
|
end
|
25
20
|
end
|
26
21
|
|
22
|
+
def set_current_attributes
|
23
|
+
@current_attributes[:running?] = run_specinfra(:check_service_is_running, name)
|
24
|
+
@current_attributes[:enabled?] = run_specinfra(:check_service_is_enabled, name)
|
25
|
+
end
|
26
|
+
|
27
27
|
def start_action(options)
|
28
28
|
run_specinfra(:start_service, name)
|
29
29
|
end
|
data/lib/itamae/version.txt
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.0.0.
|
1
|
+
1.0.0.beta34
|