itamae 1.2.16 → 1.2.17

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 78dfa7b7e2059464e87788bdf528c9d55d40fcd2
4
- data.tar.gz: 84fd0c01d7625faff3ec9de6ef9adffc7288f06c
3
+ metadata.gz: 772a7eb4b6610bba4d4870d1d75edf98109572de
4
+ data.tar.gz: 4964ef8bb3b46ab2a7d2c7af45c54c76c083c15e
5
5
  SHA512:
6
- metadata.gz: 09cef2f36431983b973c1dea0cd5f6b00ad59b9ea5c72e8ffc96e1d37e917a59e4745d1e596e7df5042079949f9def3bc0d252a12fe96a3ea7d32ceb9a5f3a85
7
- data.tar.gz: ac36e301e0d9761a3bae432e380e0c4c25c0615d21e2b3ec254478da5ce83b98451ea0815183657ec1cec4f155eeb05e438096c77aa86ef78297dc407c47c429
6
+ metadata.gz: 9da73359173c808a04958558a2044f48ff234d5b9cd8da7df7c84281bc6ae96a7911b535c60dd06ba6921a8ea971ff8b84350658425c0ab9716f2c93c8cfaa5b
7
+ data.tar.gz: e79e18c07d212949b0464a1f71c4c87315d62298df8b81abc50a1118ed7ff1b9201ee811cd044e22c1a299262bcbda1d65badaff19b811cce1d179d360f3ebf8
data/CHANGELOG.md CHANGED
@@ -1,3 +1,9 @@
1
+ ## v1.2.17
2
+
3
+ Features
4
+
5
+ - [Support provider for service resource (by @sonots)](https://github.com/itamae-kitchen/itamae/pull/134)
6
+
1
7
  ## v1.2.16
2
8
 
3
9
  Improvements
data/lib/itamae/cli.rb CHANGED
@@ -19,7 +19,7 @@ module Itamae
19
19
  option :node_json, type: :string, aliases: ['-j']
20
20
  option :node_yaml, type: :string, aliases: ['-y']
21
21
  option :dry_run, type: :boolean, aliases: ['-n']
22
- option :ohai, type: :boolean, default: false
22
+ option :ohai, type: :boolean, default: false, desc: "This option is DEPRECATED and will be inavailable."
23
23
  def local(*recipe_files)
24
24
  if recipe_files.empty?
25
25
  raise "Please specify recipe files."
@@ -37,7 +37,7 @@ module Itamae
37
37
  option :user, type: :string, aliases: ['-u']
38
38
  option :key, type: :string, aliases: ['-i']
39
39
  option :port, type: :numeric, aliases: ['-p']
40
- option :ohai, type: :boolean, default: false
40
+ option :ohai, type: :boolean, default: false, desc: "This option is DEPRECATED and will be inavailable."
41
41
  option :vagrant, type: :boolean, default: false
42
42
  option :ask_password, type: :boolean, default: false
43
43
  option :sudo, type: :boolean, default: true
@@ -58,7 +58,7 @@ module Itamae
58
58
  option :node_json, type: :string, aliases: ['-j']
59
59
  option :node_yaml, type: :string, aliases: ['-y']
60
60
  option :dry_run, type: :boolean, aliases: ['-n']
61
- option :ohai, type: :boolean, default: false
61
+ option :ohai, type: :boolean, default: false, desc: "This option is DEPRECATED and will be inavailable."
62
62
  option :image, type: :string, required: true
63
63
  option :tls_verify_peer, type: :boolean, default: true
64
64
  def docker(*recipe_files)
@@ -5,6 +5,12 @@ module Itamae
5
5
  class Service < Base
6
6
  define_attribute :action, default: :nothing
7
7
  define_attribute :name, type: String, default_name: true
8
+ define_attribute :provider, type: Symbol, default: nil
9
+
10
+ def initialize(*args)
11
+ super
12
+ @under = attributes.provider ? "_under_#{attributes.provider}" : ""
13
+ end
8
14
 
9
15
  def pre_action
10
16
  case @current_action
@@ -20,36 +26,42 @@ module Itamae
20
26
  end
21
27
 
22
28
  def set_current_attributes
23
- current.running = run_specinfra(:check_service_is_running, attributes.name)
24
- current.enabled = run_specinfra(:check_service_is_enabled, attributes.name)
29
+ current.running = run_specinfra(:"check_service_is_running#{@under}", attributes.name)
30
+ current.enabled = run_specinfra(:"check_service_is_enabled#{@under}", attributes.name)
25
31
  end
26
32
 
27
33
  def action_start(options)
28
34
  unless current.running
29
- run_specinfra(:start_service, attributes.name)
35
+ run_specinfra(:"start_service#{@under}", attributes.name)
30
36
  end
31
37
  end
32
38
 
33
39
  def action_stop(options)
34
40
  if current.running
35
- run_specinfra(:stop_service, attributes.name)
41
+ run_specinfra(:"stop_service#{@under}", attributes.name)
36
42
  end
37
43
  end
38
44
 
39
45
  def action_restart(options)
40
- run_specinfra(:restart_service, attributes.name)
46
+ run_specinfra(:"restart_service#{@under}", attributes.name)
41
47
  end
42
48
 
43
49
  def action_reload(options)
44
- run_specinfra(:reload_service, attributes.name)
50
+ if current.running
51
+ run_specinfra(:"reload_service#{@under}", attributes.name)
52
+ end
45
53
  end
46
54
 
47
55
  def action_enable(options)
48
- run_specinfra(:enable_service, attributes.name)
56
+ unless current.enabled
57
+ run_specinfra(:"enable_service#{@under}", attributes.name)
58
+ end
49
59
  end
50
60
 
51
61
  def action_disable(options)
52
- run_specinfra(:disable_service, attributes.name)
62
+ if current.enabled
63
+ run_specinfra(:"disable_service#{@under}", attributes.name)
64
+ end
53
65
  end
54
66
  end
55
67
  end
@@ -1 +1 @@
1
- 1.2.16
1
+ 1.2.17
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: itamae
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.16
4
+ version: 1.2.17
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ryota Arai
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-05-08 00:00:00.000000000 Z
11
+ date: 2015-05-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: thor