smart_proxy_salt 5.0.1 → 5.1.0

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
  SHA256:
3
- metadata.gz: 4ba18b31812c408bbbef40601e2f7279ee6f04d55a62b999b7b993f0158aede8
4
- data.tar.gz: 82822b47407c7c5e66151627a7935d294566c6e5dc17c4bbf7c2674890653826
3
+ metadata.gz: ea43480d38aa6f8d3694e61899d0b5dadeacaacc775a82d8ab2a456810bb8bcd
4
+ data.tar.gz: 6101554d6bf03679d29399f4ad92fbc51c4bfe1250e928433eca682ad015bac7
5
5
  SHA512:
6
- metadata.gz: d95ddd85199c088db57c6248d99d7a370e36c74191aeda0d74fd4f7fb7d573ee50a0b4a107092d2f8f6c3018c131e6127236cc5818f84c835eecabd0b21ef6bf
7
- data.tar.gz: d9866d18feed738e03d0e47784ee75b41921b65bcbbd33e88aec5856cfd5160e4b0b5e5485d5c25c3a6c601d6c519bde984599b734f7f081b7adce9de53c3277
6
+ metadata.gz: 9de7cddee069d666c6cc4a7400c2df16d647c4e244286a0376e8c1416555c85e1d295975017b28041305be31e2cbe02343c9da5e9688c8666b8141c0d1a8fbb1
7
+ data.tar.gz: 30464b1b58712d5a022c49b4e104fe29e5b82ad44d356cd50d59fb3b54dca0ce6b8fc7ead55e93f6ecf193c24a04782a924fbc650129c570b4606bf04f5b4408
data/bin/foreman-node CHANGED
@@ -45,7 +45,7 @@ end
45
45
 
46
46
  def get_grains(minion)
47
47
  grains = {
48
- :name => minion,
48
+ :name => minion,
49
49
  :facts => plain_grains(minion).merge(:_timestamp => Time.now, :_type => 'foreman_salt')
50
50
  }
51
51
 
@@ -94,9 +94,10 @@ end
94
94
  def plainify(hash, prefix = nil)
95
95
  result = []
96
96
  hash.each_pair do |key, value|
97
- if value.is_a?(Hash)
97
+ case value
98
+ when Hash
98
99
  result.push plainify(value, get_key(key, prefix))
99
- elsif value.is_a?(Array)
100
+ when Array
100
101
  result.push plainify(array_to_hash(value), get_key(key, prefix))
101
102
  else
102
103
  new = {}
@@ -169,12 +170,14 @@ def enc(minion)
169
170
  res = http.start { |conn| conn.request(req) }
170
171
 
171
172
  raise "Error retrieving node #{minion}: #{res.class}\nCheck Foreman's /var/log/foreman/production.log for more information." unless res.code == '200'
173
+
172
174
  res.body
173
175
  end
174
176
 
175
177
  minion = ARGV[0] || raise('Must provide minion as an argument')
176
178
 
177
179
  raise 'Invalid hostname' unless valid_hostname? minion
180
+
178
181
  begin
179
182
  result = ''
180
183
 
@@ -56,16 +56,15 @@ module Proxy
56
56
 
57
57
  def autosign_list
58
58
  return [] unless File.exist?(autosign_file)
59
+
59
60
  File.read(autosign_file).split("\n").reject do |v|
60
61
  v =~ /^\s*#.*|^$/ ## Remove comments and empty lines
61
62
  end.map(&:chomp)
62
63
  end
63
64
 
64
65
  def append_value_to_file(filepath, value)
65
- File.open(filepath, File::CREAT|File::RDWR) do |file|
66
- unless file.any? { |line| line.chomp == value}
67
- file.puts value
68
- end
66
+ File.open(filepath, File::CREAT | File::RDWR) do |file|
67
+ file.puts value unless file.any? { |line| line.chomp == value }
69
68
  end
70
69
  logger.info "Added an entry to '#{filepath}' successfully."
71
70
  true
@@ -75,7 +74,6 @@ module Proxy
75
74
  end
76
75
 
77
76
  def remove_value_from_file(filepath, value)
78
-
79
77
  return true unless File.exist?(filepath)
80
78
 
81
79
  found = false
@@ -84,14 +82,14 @@ module Proxy
84
82
  if entry == value
85
83
  found = true
86
84
  nil
87
- elsif entry == ""
85
+ elsif entry == ''
88
86
  nil
89
87
  else
90
88
  line
91
89
  end
92
90
  end.uniq.compact
93
91
  if found
94
- File.write(filepath, entries.join())
92
+ File.write(filepath, entries.join)
95
93
  logger.info "Removed an entry from '#{filepath}' successfully."
96
94
  end
97
95
  true
@@ -23,6 +23,7 @@ module Proxy
23
23
 
24
24
  files.each do |file|
25
25
  next unless file =~ /\.sls\Z/ && file != 'top.sls'
26
+
26
27
  states << file.gsub('.sls', '').gsub('/init', '').chomp('/').tr('/', '.')
27
28
  end
28
29
 
@@ -12,11 +12,11 @@ module Proxy
12
12
  class Plugin < ::Proxy::Plugin
13
13
  plugin 'salt', Proxy::Salt::VERSION
14
14
 
15
- default_settings :autosign_file => '/etc/salt/autosign.conf',
16
- :autosign_key_file => '/var/lib/foreman-proxy/salt/grains/autosign_key',
17
- :salt_command_user => 'root',
18
- :use_api => false,
19
- :saltfile => '/etc/foreman-proxy/settings.d/salt.saltfile'
15
+ default_settings :autosign_file => '/etc/salt/autosign.conf',
16
+ :autosign_key_file => '/var/lib/foreman-proxy/salt/grains/autosign_key',
17
+ :salt_command_user => 'root',
18
+ :use_api => false,
19
+ :saltfile => '/etc/foreman-proxy/settings.d/salt.saltfile'
20
20
 
21
21
  requires :dynflow, '>= 0.5.0'
22
22
 
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'smart_proxy_dynflow/runner/base'
2
4
  require 'smart_proxy_dynflow/runner/command_runner'
3
5
 
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'smart_proxy_dynflow/task_launcher'
2
4
 
3
5
  module Proxy
@@ -3,6 +3,6 @@
3
3
  module Proxy
4
4
  # Salt module
5
5
  module Salt
6
- VERSION = '5.0.1'.freeze
6
+ VERSION = '5.1.0'
7
7
  end
8
8
  end
@@ -1,4 +1,4 @@
1
- #!/usr/bin/salt_python_wrapper
1
+ #!/usr/bin/python3
2
2
  # Uploads reports from the Salt job cache to Foreman
3
3
 
4
4
  from __future__ import print_function
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: smart_proxy_salt
3
3
  version: !ruby/object:Gem::Version
4
- version: 5.0.1
4
+ version: 5.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Michael Moll
@@ -9,96 +9,15 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2022-11-28 00:00:00.000000000 Z
12
+ date: 2024-04-17 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
- name: test-unit
16
- requirement: !ruby/object:Gem::Requirement
17
- requirements:
18
- - - "~>"
19
- - !ruby/object:Gem::Version
20
- version: '2'
21
- type: :development
22
- prerelease: false
23
- version_requirements: !ruby/object:Gem::Requirement
24
- requirements:
25
- - - "~>"
26
- - !ruby/object:Gem::Version
27
- version: '2'
28
- - !ruby/object:Gem::Dependency
29
- name: mocha
30
- requirement: !ruby/object:Gem::Requirement
31
- requirements:
32
- - - "~>"
33
- - !ruby/object:Gem::Version
34
- version: '1'
35
- type: :development
36
- prerelease: false
37
- version_requirements: !ruby/object:Gem::Requirement
38
- requirements:
39
- - - "~>"
40
- - !ruby/object:Gem::Version
41
- version: '1'
42
- - !ruby/object:Gem::Dependency
43
- name: webmock
44
- requirement: !ruby/object:Gem::Requirement
45
- requirements:
46
- - - "~>"
47
- - !ruby/object:Gem::Version
48
- version: '1'
49
- type: :development
50
- prerelease: false
51
- version_requirements: !ruby/object:Gem::Requirement
52
- requirements:
53
- - - "~>"
54
- - !ruby/object:Gem::Version
55
- version: '1'
56
- - !ruby/object:Gem::Dependency
57
- name: rake
58
- requirement: !ruby/object:Gem::Requirement
59
- requirements:
60
- - - "~>"
61
- - !ruby/object:Gem::Version
62
- version: '13'
63
- type: :development
64
- prerelease: false
65
- version_requirements: !ruby/object:Gem::Requirement
66
- requirements:
67
- - - "~>"
68
- - !ruby/object:Gem::Version
69
- version: '13'
70
- - !ruby/object:Gem::Dependency
71
- name: rubocop
72
- requirement: !ruby/object:Gem::Requirement
73
- requirements:
74
- - - '='
75
- - !ruby/object:Gem::Version
76
- version: 0.50.0
77
- type: :development
78
- prerelease: false
79
- version_requirements: !ruby/object:Gem::Requirement
80
- requirements:
81
- - - '='
82
- - !ruby/object:Gem::Version
83
- version: 0.50.0
84
- - !ruby/object:Gem::Dependency
85
- name: rack-test
15
+ name: smart_proxy_dynflow
86
16
  requirement: !ruby/object:Gem::Requirement
87
17
  requirements:
88
18
  - - "~>"
89
19
  - !ruby/object:Gem::Version
90
- version: '0'
91
- type: :development
92
- prerelease: false
93
- version_requirements: !ruby/object:Gem::Requirement
94
- requirements:
95
- - - "~>"
96
- - !ruby/object:Gem::Version
97
- version: '0'
98
- - !ruby/object:Gem::Dependency
99
- name: smart_proxy_dynflow
100
- requirement: !ruby/object:Gem::Requirement
101
- requirements:
20
+ version: '0.5'
102
21
  - - ">="
103
22
  - !ruby/object:Gem::Version
104
23
  version: 0.5.0
@@ -106,14 +25,16 @@ dependencies:
106
25
  prerelease: false
107
26
  version_requirements: !ruby/object:Gem::Requirement
108
27
  requirements:
28
+ - - "~>"
29
+ - !ruby/object:Gem::Version
30
+ version: '0.5'
109
31
  - - ">="
110
32
  - !ruby/object:Gem::Version
111
33
  version: 0.5.0
112
- description: SaltStack Plug-In for Foreman's Smart Proxy
34
+ description: This plug-in adds support for Salt to Foreman's Smart Proxy
113
35
  email: foreman-dev@googlegroups.com
114
36
  executables:
115
37
  - foreman-node
116
- - salt_python_wrapper
117
38
  extensions: []
118
39
  extra_rdoc_files:
119
40
  - README.md
@@ -122,7 +43,6 @@ files:
122
43
  - LICENSE
123
44
  - README.md
124
45
  - bin/foreman-node
125
- - bin/salt_python_wrapper
126
46
  - bundler.d/salt.rb
127
47
  - etc/foreman.conf.example
128
48
  - etc/foreman.yaml.example
@@ -160,15 +80,17 @@ required_ruby_version: !ruby/object:Gem::Requirement
160
80
  requirements:
161
81
  - - ">="
162
82
  - !ruby/object:Gem::Version
163
- version: '0'
83
+ version: '2.7'
84
+ - - "<"
85
+ - !ruby/object:Gem::Version
86
+ version: '4'
164
87
  required_rubygems_version: !ruby/object:Gem::Requirement
165
88
  requirements:
166
89
  - - ">="
167
90
  - !ruby/object:Gem::Version
168
91
  version: '0'
169
92
  requirements: []
170
- rubyforge_project:
171
- rubygems_version: 2.7.6
93
+ rubygems_version: 3.3.26
172
94
  signing_key:
173
95
  specification_version: 4
174
96
  summary: SaltStack Plug-In for Foreman's Smart Proxy
@@ -1,16 +0,0 @@
1
- #!/bin/sh
2
-
3
- set -u
4
-
5
- for py in 'python3' 'python'; do
6
- exe=$(type -p ${py})
7
- if [ -n "${exe}" ]; then
8
- if ${exe} -c 'import salt.config'; then
9
- ${exe} "$@"
10
- exit $?
11
- fi
12
- fi
13
- done
14
-
15
- echo "No usable python version found, check if python or python3 can import salt.config!" 1>&2
16
- exit 1