itamae 1.0.0.beta33 → 1.0.0.beta34

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: c7789de3e2192706f3fbc070c21b4c8655ee069e
4
- data.tar.gz: 53c079ad48be16240db72583dbd259789f13f18f
3
+ metadata.gz: 35649d044a624b2d15b00968214ab5a9bbdec57d
4
+ data.tar.gz: 5f221d3341a367ba33934195034f2b146f04d992
5
5
  SHA512:
6
- metadata.gz: ebe47750eca4115b24f816d646305df6b61eb370bb0955db711fc0fe522c20f6f72cdfb953d5029d67a8eda8ff367b20e027b39e7d94b9d81f71bab3bf156a97
7
- data.tar.gz: fe8db93b2450cbd67a3038f482f3773cd8e6a77fd5d20fe2f3bfc983311cae8b612186645cd1b9203ef3642990e4c5ecc9eddfd593e18be33c85b0754bf1f7c7
6
+ metadata.gz: a19fe887f749d27ca6f9b9c4eef51a974711f8a79257d2ec6cb8e41e177bd8ed37144a42ba652845a88465d7740a1e8d5641d1e508fcff09a13251152c5282be
7
+ data.tar.gz: e9fb236ceda5b1901c940053369a75cd37da70e1030a546e2f6a18d92ec49f72eadac7223d9b4221e990657f7f7e200768353a633c63ca9407f2e957db577e29
@@ -74,14 +74,6 @@ module Itamae
74
74
  def method_missing(method, *args, &block)
75
75
  logger.public_send(method, *args, &block)
76
76
  end
77
-
78
- def depth
79
- @depth || 0
80
- end
81
-
82
- def depth=(value)
83
- @depth = value
84
- end
85
77
  end
86
78
  end
87
79
  end
@@ -60,18 +60,27 @@ module Itamae
60
60
  return
61
61
  end
62
62
 
63
- pre_action
63
+ [action].flatten.each do |action|
64
+ @current_action = action
64
65
 
65
- set_current_attributes
66
- show_differences
66
+ Logger.info "action: #{action}"
67
67
 
68
- unless options[:dry_run]
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)
@@ -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
@@ -11,7 +11,7 @@ module Itamae
11
11
  define_attribute :revision, type: String
12
12
 
13
13
  def pre_action
14
- case action
14
+ case @current_action
15
15
  when :sync
16
16
  @attributes[:exist?] = true
17
17
  end
@@ -8,7 +8,7 @@ module Itamae
8
8
  define_attribute :to, type: String, required: true
9
9
 
10
10
  def pre_action
11
- case action
11
+ case @current_action
12
12
  when :create
13
13
  @attributes[:exist?] = true
14
14
  end
@@ -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 set_current_attributes
10
- @current_attributes[:running?] = run_specinfra(:check_service_is_running, name)
11
- @current_attributes[:enabled?] = run_specinfra(:check_service_is_enabled, name)
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
- elsif actions.include?(:stop)
13
+ when :stop
17
14
  @attributes[:running?] = false
18
- end
19
-
20
- if actions.include?(:enable)
15
+ when :enable
21
16
  @attributes[:enabled?] = true
22
- elsif actions.include?(:disable)
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
@@ -1 +1 @@
1
- 1.0.0.beta33
1
+ 1.0.0.beta34
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: itamae
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0.beta33
4
+ version: 1.0.0.beta34
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ryota Arai