rundock 1.0.4 → 1.0.5

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: 925ab13ad979b5530cb89efe8959dc41fcebf645
4
- data.tar.gz: 832c4b8fd3795c6b7890dabad8b5e42d03508913
3
+ metadata.gz: fa664318ebae9c57a378f4e5ccef806395eb2fbc
4
+ data.tar.gz: 45d2618d0d9b0e76180ca754d5f4d39d3009abe2
5
5
  SHA512:
6
- metadata.gz: 8bf6370c8170c3331cf428e62bac57e7a2ba8930d2bc87936e3d876e292c584aeb604d8c6dcac716aca44c6fe6d7334fd9c78fe3bae17850f10f886765df9f45
7
- data.tar.gz: c5c840860294fc05324a380a80aa104dacac3179f16ff94a94178561fa0c204dc91cee641a0cfee6aee6820ccdf883a88cadaa3a46f0ae1967943a80ebf1a022
6
+ metadata.gz: 2f9114c8b24850151732f713e4d9311d90d75b0597032af5c402a427aa7d1de4b2bce37e3c9de0e76fb86ef58472f7fd606bc82faeb37bd82780f9ed5458ae59
7
+ data.tar.gz: 70295a6126b533ed8863bef489f2483d9269f006a7984bb46b22cb1d9271ae7daf9249a443a68f96b00b37d47455c402416450f6b26cd5d5e7ea3f571f155bc3
@@ -0,0 +1,6 @@
1
+ class String
2
+ def just(pad, max)
3
+ return self.ljust(max, pad) if length <= max
4
+ return "#{self[0..(max - 3)]}.." if length > max
5
+ end
6
+ end
@@ -15,6 +15,12 @@ module Rundock
15
15
  def run(backend, attributes = {})
16
16
  raise OperationNotImplementedError
17
17
  end
18
+
19
+ def logging(message, severity)
20
+ h_host = @attributes[:nodename].just(' ', 15)
21
+ h_ope = "start #{self.class.to_s.split('::').last.downcase}:"
22
+ Logger.send(severity.to_sym, "#{h_host} #{h_ope} #{message}")
23
+ end
18
24
  end
19
25
  end
20
26
  end
@@ -8,7 +8,7 @@ module Rundock
8
8
  next
9
9
  end
10
10
 
11
- Logger.info("start command: #{i}")
11
+ logging(i, 'info')
12
12
 
13
13
  backend.run_commands(
14
14
  assign_args(i, attributes[:task_args]), attributes
@@ -15,8 +15,7 @@ module Rundock
15
15
  attributes[:task_info][task_name.to_sym], backend, Rundock::Attribute::NodeAttribute.new(attributes)
16
16
  )
17
17
 
18
- Logger.info("start task: #{task_name}")
19
-
18
+ logging(i, 'info')
20
19
  Logger.formatter.rec_lock
21
20
 
22
21
  scenario.run
@@ -60,7 +60,7 @@ module Rundock
60
60
  erb_options = ''
61
61
  erb_options = " erb: true trim_mode: #{trim_mode}" if is_erb
62
62
 
63
- Logger.info("deploy localhost: #{opt[:src]} remote:#{attributes[:nodeinfo][:host]}:#{opt[:dst]}#{erb_options}")
63
+ logging("deploy localhost: #{opt[:src]} remote:#{attributes[:nodeinfo][:host]}:#{opt[:dst]}#{erb_options}", 'info')
64
64
  Logger.debug("deploy erb binding: #{opt[:binding]}") if is_erb
65
65
 
66
66
  val_binding = if is_erb
@@ -19,7 +19,7 @@ module Rundock
19
19
  class HostInventory < Base
20
20
  def run(backend, attributes)
21
21
  attributes[:host_inventory].each do |hi|
22
- Logger.info(to_inventory(backend, hi))
22
+ logging(to_inventory(backend, hi), 'info')
23
23
  end
24
24
  end
25
25
 
@@ -35,7 +35,7 @@ module Rundock
35
35
  end
36
36
  end
37
37
 
38
- Logger.info("do #{cmd}#{args_line}")
38
+ logging("do #{cmd}#{args_line}", 'info')
39
39
  result = backend.run_command("#{cmd}#{args_line}")
40
40
  Logger.info(result.stdout)
41
41
  end
@@ -1,3 +1,3 @@
1
1
  module Rundock
2
- VERSION = '1.0.4'
2
+ VERSION = '1.0.5'
3
3
  end
data/lib/rundock.rb CHANGED
@@ -1,6 +1,7 @@
1
1
  require 'rundock/version'
2
2
  require 'rundock/ext/object/blank'
3
3
  require 'rundock/ext/hash'
4
+ require 'rundock/ext/string'
4
5
  require 'rundock/logger'
5
6
  require 'rundock/operation/base'
6
7
  require 'rundock/operation/task'
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rundock
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.4
4
+ version: 1.0.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - hiracy
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2016-07-26 00:00:00.000000000 Z
11
+ date: 2016-07-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -167,6 +167,7 @@ files:
167
167
  - lib/rundock/cli.rb
168
168
  - lib/rundock/ext/hash.rb
169
169
  - lib/rundock/ext/object/blank.rb
170
+ - lib/rundock/ext/string.rb
170
171
  - lib/rundock/gem/helper.rb
171
172
  - lib/rundock/gem/tasks.rb
172
173
  - lib/rundock/hook/base.rb