foreman_ansible_core 2.1.0 → 2.1.1

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
- SHA256:
3
- metadata.gz: 61eb151e42e1f8d309d82914c001d3ea533255702176c5be70c1d465577aff15
4
- data.tar.gz: 9001d911f362e894629d10721fa916287a6305576c81c3b8dd22894fffe9b71d
2
+ SHA1:
3
+ metadata.gz: c69f61506d641e18d27a22a32514cdb6221174dd
4
+ data.tar.gz: 9afe8696e6723ad9ab66adf416b457e8fa9dfec8
5
5
  SHA512:
6
- metadata.gz: 5b212d6da9a5d72dca9d83a2c14fed8e65fdd51dbeadd36578ce8a2a266510fb785469def88d0d00e018fbffab8d08069fce49628cf6426fcb1d4489b78c8705
7
- data.tar.gz: ee82571d20690e764506ccf82a06563ddd7287c4c56dbd065fb6c635a6cb7bec9e0ebd3f9c3a4033c990ea871aa16af280f5940836b7f4a374758560703a12c8
6
+ metadata.gz: c40433c92f4c4f3d617562cad983a0b116b8240830bb14d6d641aa17187845dc1649a3e4da75f81af6485b66efffc69f8fc2a431212e938989c10fa54604ef3b
7
+ data.tar.gz: 7080dd69b55873db5305ba237dc7d5e7331cecd1e23c2969125eaf553e115573663205bf0fa46b5331686661330150c44a7dec6fc5278b5f9070498f87e83c5e
@@ -1,23 +1,34 @@
1
1
  module ForemanAnsibleCore
2
2
  # Creates the actual command to be passed to foreman_tasks_core to run
3
3
  class CommandCreator
4
- attr_reader :command
5
-
6
4
  def initialize(inventory_file, playbook_file, options = {})
7
5
  @options = options
8
- @command = [{ 'JSON_INVENTORY_FILE' => inventory_file }]
9
- @command << 'ansible-playbook'
10
- @command = command_options(@command)
11
- @command << playbook_file
6
+ @playbook_file = playbook_file
7
+ @inventory_file = inventory_file
8
+ command
9
+ end
10
+
11
+ def command
12
+ parts = [environment_variables]
13
+ parts << 'ansible-playbook'
14
+ parts.concat(command_options)
15
+ parts << @playbook_file
16
+ parts
12
17
  end
13
18
 
14
19
  private
15
20
 
16
- def command_options(command)
17
- command.concat(['-i', json_inventory_script])
18
- command.concat([setup_verbosity]) if verbose?
19
- command.concat(['-T', @options[:timeout]]) unless @options[:timeout].nil?
20
- command
21
+ def environment_variables
22
+ defaults = { 'JSON_INVENTORY_FILE' => @inventory_file }
23
+ defaults['ANSIBLE_CALLBACK_WHITELIST'] = '' if rex_command?
24
+ defaults
25
+ end
26
+
27
+ def command_options
28
+ opts = ['-i', json_inventory_script]
29
+ opts.concat([setup_verbosity]) if verbose?
30
+ opts.concat(['-T', @options[:timeout]]) unless @options[:timeout].nil?
31
+ opts
21
32
  end
22
33
 
23
34
  def json_inventory_script
@@ -40,5 +51,9 @@ module ForemanAnsibleCore
40
51
  verbosity_level.to_i > 0
41
52
  # rubocop:enable Rails/Present
42
53
  end
54
+
55
+ def rex_command?
56
+ @options[:remote_execution_command]
57
+ end
43
58
  end
44
59
  end
@@ -1,3 +1,3 @@
1
1
  module ForemanAnsibleCore
2
- VERSION = '2.1.0'.freeze
2
+ VERSION = '2.1.1'.freeze
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: foreman_ansible_core
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.1.0
4
+ version: 2.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Daniel Lobato Garcia
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-06-15 00:00:00.000000000 Z
11
+ date: 2018-07-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rubocop
@@ -106,7 +106,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
106
106
  version: '0'
107
107
  requirements: []
108
108
  rubyforge_project:
109
- rubygems_version: 2.7.3
109
+ rubygems_version: 2.6.8
110
110
  signing_key:
111
111
  specification_version: 4
112
112
  summary: 'Ansible integration with Foreman (theforeman.org): core bits'