smart_proxy_salt 2.1.7 → 2.1.8
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/bin/foreman-node +1 -1
- data/lib/smart_proxy_salt/version.rb +1 -1
- data/sbin/upload-salt-reports +17 -19
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3617d7030f84c637b456820c2ed126a46a0891f8
|
4
|
+
data.tar.gz: e38b6cbe39839ac23e9b734fd1b72ee5baeb10fb
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5b4b844c9a4463aa77ca9769028fd5d32d9efa933c4ecc6cf90391ab437f78936a7882583f548bfa338c33dfd4731e27fba5f1d233e650521aaf3411888cf824
|
7
|
+
data.tar.gz: 657c0199e6aea9a2fefdcc4847f2a7107ba4dd1fbf28c2e7413a4119a09c79680e69a5ed569e13f2e854a07096ba82bc8e8e69752ea5e3b1b9fbf26f47f57c45
|
data/bin/foreman-node
CHANGED
@@ -172,7 +172,7 @@ def enc(minion)
|
|
172
172
|
http.cert = OpenSSL::X509::Certificate.new(File.read(SETTINGS[:ssl_cert]))
|
173
173
|
http.key = OpenSSL::PKey::RSA.new(File.read(SETTINGS[:ssl_key]), nil)
|
174
174
|
end
|
175
|
-
elsif SETTINGS[:username] &&
|
175
|
+
elsif SETTINGS[:username] && SETTINGS[:password]
|
176
176
|
req.basic_auth(SETTINGS[:username], SETTINGS[:password])
|
177
177
|
end
|
178
178
|
|
data/sbin/upload-salt-reports
CHANGED
@@ -5,7 +5,6 @@ LAST_UPLOADED = '/etc/salt/last_uploaded'
|
|
5
5
|
FOREMAN_CONFIG = '/etc/salt/foreman.yaml'
|
6
6
|
LOCK_FILE = '/var/lock/salt-report-upload.lock'
|
7
7
|
|
8
|
-
import urllib
|
9
8
|
import httplib
|
10
9
|
import ssl
|
11
10
|
import json
|
@@ -27,7 +26,7 @@ def salt_config():
|
|
27
26
|
|
28
27
|
|
29
28
|
def get_job(job_id):
|
30
|
-
result = run('jobs.lookup_jid',
|
29
|
+
result = run('jobs.lookup_jid', [job_id])
|
31
30
|
|
32
31
|
# If any minion's results are strings, they're exceptions
|
33
32
|
# and should be wrapped in a list like other errors
|
@@ -64,31 +63,31 @@ def write_last_uploaded(last_uploaded):
|
|
64
63
|
f.write(last_uploaded)
|
65
64
|
|
66
65
|
|
67
|
-
def run(
|
66
|
+
def run(*args, **kwargs):
|
68
67
|
__opts__ = salt.config.master_config(
|
69
68
|
os.environ.get('SALT_MASTER_CONFIG', '/etc/salt/master'))
|
70
69
|
|
71
70
|
runner = salt.runner.Runner(__opts__)
|
72
|
-
stdout_bak = sys.stdout
|
73
71
|
with open(os.devnull, 'wb') as f:
|
74
|
-
sys.stdout = f
|
75
|
-
|
76
|
-
|
72
|
+
stdout_bak, sys.stdout = sys.stdout, f
|
73
|
+
try:
|
74
|
+
ret = runner.cmd(*args, **kwargs)
|
75
|
+
finally:
|
76
|
+
sys.stdout = stdout_bak
|
77
77
|
return ret['data'] if 'data' in ret else ret
|
78
78
|
|
79
79
|
|
80
80
|
def jobs_to_upload():
|
81
|
-
jobs = run('jobs.list_jobs'
|
81
|
+
jobs = run('jobs.list_jobs', kwarg={
|
82
|
+
"search_function": "state.highstate",
|
83
|
+
})
|
82
84
|
last_uploaded = read_last_uploaded()
|
83
85
|
|
84
|
-
job_ids = [
|
85
|
-
|
86
|
-
int(id) > last_uploaded]
|
86
|
+
job_ids = [jid for (jid, value) in jobs.iteritems()
|
87
|
+
if int(jid) > last_uploaded]
|
87
88
|
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
return (ids, jobs)
|
89
|
+
for job_id in sorted(job_ids):
|
90
|
+
yield job_id, get_job(job_id)
|
92
91
|
|
93
92
|
|
94
93
|
def upload(jobs):
|
@@ -111,8 +110,7 @@ def upload(jobs):
|
|
111
110
|
config[':password']))
|
112
111
|
headers['Authorization'] = 'Basic {}'.format(token)
|
113
112
|
|
114
|
-
for
|
115
|
-
job = jobs[1][id]
|
113
|
+
for job_id, job in jobs:
|
116
114
|
|
117
115
|
if job['job']['result'] == {}:
|
118
116
|
continue
|
@@ -122,8 +120,8 @@ def upload(jobs):
|
|
122
120
|
response = connection.getresponse()
|
123
121
|
|
124
122
|
if response.status == 200:
|
125
|
-
write_last_uploaded(
|
126
|
-
print "Success %s: %s" % (
|
123
|
+
write_last_uploaded(job_id)
|
124
|
+
print "Success %s: %s" % (job_id, response.read())
|
127
125
|
else:
|
128
126
|
print "Unable to upload job - aborting report upload"
|
129
127
|
print response.read()
|
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: 2.1.
|
4
|
+
version: 2.1.8
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Michael Moll
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2017-03-29 00:00:00.000000000 Z
|
13
13
|
dependencies: []
|
14
14
|
description: SaltStack Plug-In for Foreman's Smart Proxy
|
15
15
|
email: foreman-dev@googlegroups.com
|
@@ -56,7 +56,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
56
56
|
version: '0'
|
57
57
|
requirements: []
|
58
58
|
rubyforge_project:
|
59
|
-
rubygems_version: 2.5.
|
59
|
+
rubygems_version: 2.5.2
|
60
60
|
signing_key:
|
61
61
|
specification_version: 4
|
62
62
|
summary: SaltStack Plug-In for Foreman's Smart Proxy
|