hammer_cli_foreman_tasks 0.0.10 → 0.0.11

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: e08456719989bef2b947764f5da8bdd36677855d
4
- data.tar.gz: 7e5cfe2be5b590da04d022172f41e23dbe24c7a2
3
+ metadata.gz: 239c97cd594485719d3350f4713a4d6b8f642390
4
+ data.tar.gz: 566eddb498134730b3e53c8e0436bad0ae157c42
5
5
  SHA512:
6
- metadata.gz: eb7245f9cbe82902705d77160ac82848b17505f08a45065f65244a8d405c773d37fe80ee7609c617be97b36ee2c4e94a3dc68ffec1e06e5990654b1eff05fb9a
7
- data.tar.gz: daea674196ecb2d620654331174dc3586ec9cf0a2be695cf66f909b5c91837ad5dd156d938baa2591841b43fb6882f2a02b22c480037da8b1f35d6306401bfe7
6
+ metadata.gz: 7e512e3f463d8e29bb92a21b8557cd1a7e40e32ff9256a60bc95c5cd2e1bc236517f4b04aeba36c5a16584a7f0abea899301c4a6d57a861dde91b145ce0500af
7
+ data.tar.gz: e0dda4e0fc7d32511ff7aa1794029b178ba0e36f5e8c849e1d4813ff040e8cdcb0705ac9680bbf86d052caab76ecc9a9b1da1b0ee91960494a7b68b8fef87b70
@@ -11,8 +11,8 @@ module HammerCLIForemanTasks
11
11
  if option_async?
12
12
  super
13
13
  else
14
- task_progress(send_request)
15
- HammerCLI::EX_OK
14
+ success = task_progress(send_request)
15
+ success ? HammerCLI::EX_OK : HammerCLI::EX_SOFTWARE
16
16
  end
17
17
  end
18
18
 
@@ -4,9 +4,9 @@ module HammerCLIForemanTasks
4
4
  # render the progress of the task using polling to the task API
5
5
  def task_progress(task_or_id)
6
6
  task_id = task_or_id.is_a?(Hash) ? task_or_id['id'] : task_or_id
7
- TaskProgress.new(task_id) { |id| load_task(id) }.tap do |task_progress|
8
- task_progress.render
9
- end
7
+ task_progress = TaskProgress.new(task_id) { |id| load_task(id) }
8
+ task_progress.render
9
+ task_progress.success?
10
10
  end
11
11
 
12
12
  def load_task(id)
@@ -14,8 +14,8 @@ module HammerCLIForemanTasks
14
14
  desc _("Show the progress of the task")
15
15
 
16
16
  def execute
17
- task_progress(option_id)
18
- HammerCLI::EX_OK
17
+ success = task_progress(option_id)
18
+ success ? HammerCLI::EX_OK : HammerCLI::EX_SOFTWARE
19
19
  end
20
20
 
21
21
  end
@@ -14,6 +14,10 @@ module HammerCLIForemanTasks
14
14
  render_progress
15
15
  end
16
16
 
17
+ def success?
18
+ !%w(error warning).include?(@task['result'])
19
+ end
20
+
17
21
  private
18
22
 
19
23
  def render_progress
@@ -40,7 +44,7 @@ module HammerCLIForemanTasks
40
44
 
41
45
  def render_result
42
46
  puts @task['humanized']['output'] unless @task['humanized']['output'].to_s.empty?
43
- STDERR.puts @task['humanized']['errors'].join("\n") unless @task['humanized']['errors'].to_s.empty?
47
+ STDERR.puts "Error: #{@task['humanized']['errors'].join("\n")}" unless @task['humanized']['errors'].empty?
44
48
  end
45
49
 
46
50
  def update_task
@@ -1,5 +1,5 @@
1
1
  module HammerCLIForemanTasks
2
2
  def self.version
3
- @version ||= Gem::Version.new('0.0.10')
3
+ @version ||= Gem::Version.new('0.0.11')
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: hammer_cli_foreman_tasks
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.10
4
+ version: 0.0.11
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ivan Nečas
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-02-18 00:00:00.000000000 Z
11
+ date: 2017-10-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: powerbar
@@ -87,7 +87,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
87
87
  version: '0'
88
88
  requirements: []
89
89
  rubyforge_project:
90
- rubygems_version: 2.4.8
90
+ rubygems_version: 2.6.12
91
91
  signing_key:
92
92
  specification_version: 4
93
93
  summary: Foreman CLI plugin for showing tasks information for resoruces and users