rundock 0.4.4 → 0.4.6

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: df165ae264ffe0a704900cdaf4ed5d69593e686b
4
- data.tar.gz: d72ac21d2fa76ae403a89dc2d7fe506a7e833070
3
+ metadata.gz: 1d532a47dd13d4984578e9656a3151f0ad93b8be
4
+ data.tar.gz: 9d95035091ac1e71c25d1d81816704559e7bb0f6
5
5
  SHA512:
6
- metadata.gz: f918f3c4f9368a2adf2b1b936595df01e33f6170892e2fd20567eb7b425379fb7852e4358f1d6b6e14409c0f7b009142cd0661a3ccc5b87cf93c81a362060d8b
7
- data.tar.gz: 9b7cd89601da18e479a4626e9bbabb5f5c5712a46192dbc53103e2a503538c0138f12db885a98ceea6a2914b466524d494c31459b0a363f5dcbb57fa35fa96a2
6
+ metadata.gz: 43d4e506533db7b293a508babe5a6fd19c81401e73f9aa0212edfaa9ad9beaa6cbf05b92295ccdbc7dfe1c9a4e0260bd38efc2b30436faaf314115a7527624c0
7
+ data.tar.gz: 4fc6a25576ee186de97e24b9a0e5a60fb2095a404b5265c691aead34c466806f892d4c6670f8fbab75d2a29e4de92ef0d6895c4cf9849af8621070301b48b476
@@ -3,17 +3,23 @@ require 'yaml'
3
3
  module Rundock
4
4
  module Builder
5
5
  class HookBuilder < Base
6
+ DEFAULT_HOOKS_FILE_PATH = './hooks.yml'
6
7
  HookStructureError = Class.new(NotImplementedError)
7
8
 
8
9
  def build(enables)
9
10
  if enables.blank?
10
11
  Logger.error('Empty hook is specified.')
11
12
  return []
12
- elsif @options[:hooks] && FileTest.exist?(@options[:hooks])
13
- hooks_file = @options[:hooks]
14
- Logger.info("hooks file is #{hooks_file}")
13
+ elsif @options[:hooks]
14
+ if FileTest.exist?(@options[:hooks])
15
+ hooks_file = @options[:hooks]
16
+ Logger.info("hooks file is #{hooks_file}")
17
+ else
18
+ Logger.warn("hooks file is not found. use #{DEFAULT_HOOKS_FILE_PATH}")
19
+ hooks_file = DEFAULT_HOOKS_FILE_PATH
20
+ end
15
21
  else
16
- Logger.error('Empty hook detected. Please specifiy hook option.')
22
+ Logger.info('Empty hook is specified.')
17
23
  return []
18
24
  end
19
25
 
@@ -42,7 +48,7 @@ module Rundock
42
48
  end
43
49
  end
44
50
 
45
- Logger.error('Empty hook detected. Please verify hooks file and scenario file.')
51
+ Logger.warn('Empty hook is detected. Please verity hooks file and scenario file.') if hooks.empty?
46
52
  hooks
47
53
  end
48
54
  end
data/lib/rundock/cli.rb CHANGED
@@ -6,7 +6,6 @@ module Rundock
6
6
  DEFAULT_SCENARIO_FILE_PATH = './scenario.yml'
7
7
  DEFAULT_SSH_OPTIONS_DEFAULT_FILE_PATH = './default_ssh.yml'
8
8
  DEFAULT_HOSTGROUP_FILE_PATH = './hostgroup.yml'
9
- DEFAULT_HOOKS_FILE_PATH = './hooks.yml'
10
9
 
11
10
  class_option :log_level, type: :string, aliases: ['-l'], default: 'info'
12
11
  class_option :color, type: :boolean, default: true
@@ -28,7 +27,7 @@ module Rundock
28
27
  desc 'do [SCENARIO] [options]', 'Run rundock from scenario file'
29
28
  option :sudo, type: :boolean, default: false
30
29
  option :default_ssh_opts, type: :string, aliases: ['-d'], default: DEFAULT_SSH_OPTIONS_DEFAULT_FILE_PATH
31
- option :hooks, type: :string, aliases: ['-k'], default: DEFAULT_HOOKS_FILE_PATH
30
+ option :hooks, type: :string, aliases: ['-k']
32
31
  option :run_anyway, type: :boolean, default: false
33
32
  option :dry_run, type: :boolean, aliases: ['-n']
34
33
  def do(*scenario_file_path)
@@ -41,7 +40,7 @@ module Rundock
41
40
  desc 'ssh [options]', 'Run rundock ssh with various options'
42
41
  option :command, type: :string, aliases: ['-c']
43
42
  option :default_ssh_opts, type: :string, aliases: ['-d'], default: DEFAULT_SSH_OPTIONS_DEFAULT_FILE_PATH
44
- option :hooks, type: :string, aliases: ['-k'], default: DEFAULT_HOOKS_FILE_PATH
43
+ option :hooks, type: :string, aliases: ['-k']
45
44
  option :host, type: :string, aliases: ['-h'], banner: 'You can specify comma separated hosts.[ex: host1,host2,..]'
46
45
  option :hostgroup, type: :string, aliases: ['-g']
47
46
  option :user, type: :string, aliases: ['-u']
@@ -1,3 +1,3 @@
1
1
  module Rundock
2
- VERSION = '0.4.4'
2
+ VERSION = '0.4.6'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rundock
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.4
4
+ version: 0.4.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - hiracy