smart_proxy_salt 5.1.0 → 6.0.0
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
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: fd14287d87c9ed2e41a86539f25b52f741549f20501b5f6dc7936075cca3fdad
|
4
|
+
data.tar.gz: af25b8597c836c1b5a8fd726612f6c49d05a87b50e877c19f42e2836d97c1717
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ecdaa039f92b673ab76340da06d92397d01980baf5c7956687cd2314ff1e8e579af6beed07f1a966312c285adc30606895a3c1545ffb0e38b8a68bc087328b76
|
7
|
+
data.tar.gz: 23853c34472f6cbb3a674c5c88806167c5f6be692032ecc08a474ae335ad842e477ce8425a8ef35787878b51128bad278bf90bca014b3fbc5c6937062e297889
|
@@ -19,8 +19,8 @@ def salt_config():
|
|
19
19
|
"""
|
20
20
|
Read the foreman configuratoin from FOREMAN_CONFIG
|
21
21
|
"""
|
22
|
-
with open(FOREMAN_CONFIG
|
23
|
-
config = yaml.
|
22
|
+
with open(FOREMAN_CONFIG) as config_file:
|
23
|
+
config = yaml.safe_load(config_file.read())
|
24
24
|
return config
|
25
25
|
|
26
26
|
|
@@ -1,45 +1,32 @@
|
|
1
|
-
# -*- coding: utf-8 -*-
|
2
1
|
'''
|
3
2
|
Uploads reports from the Salt job cache to Foreman
|
4
3
|
'''
|
5
|
-
from __future__ import absolute_import, print_function, unicode_literals
|
6
4
|
|
7
|
-
|
8
|
-
FOREMAN_CONFIG = '/etc/salt/foreman.yaml'
|
9
|
-
LOCK_FILE = '/var/lock/salt-report-upload.lock'
|
5
|
+
from http.client import HTTPConnection, HTTPSConnection
|
10
6
|
|
11
|
-
try:
|
12
|
-
from http.client import HTTPConnection, HTTPSConnection
|
13
|
-
except ImportError:
|
14
|
-
from httplib import HTTPSConnection, HTTPSConnection
|
15
|
-
|
16
|
-
import io
|
17
7
|
import ssl
|
18
8
|
import json
|
19
9
|
import yaml
|
20
10
|
import os
|
21
|
-
import sys
|
22
11
|
import base64
|
23
|
-
|
24
|
-
# Import python libs
|
25
12
|
import logging
|
26
13
|
|
27
|
-
|
28
|
-
|
14
|
+
LAST_UPLOADED = '/etc/salt/last_uploaded'
|
15
|
+
FOREMAN_CONFIG = '/etc/salt/foreman.yaml'
|
16
|
+
LOCK_FILE = '/var/lock/salt-report-upload.lock'
|
29
17
|
|
30
|
-
|
31
|
-
unicode = str
|
18
|
+
log = logging.getLogger(__name__)
|
32
19
|
|
33
20
|
|
34
21
|
def salt_config():
|
35
|
-
with open(FOREMAN_CONFIG
|
36
|
-
config = yaml.
|
22
|
+
with open(FOREMAN_CONFIG) as f:
|
23
|
+
config = yaml.safe_load(f.read())
|
37
24
|
return config
|
38
25
|
|
39
26
|
|
40
27
|
def write_last_uploaded(last_uploaded):
|
41
|
-
with
|
42
|
-
f.write(
|
28
|
+
with open(LAST_UPLOADED, 'w+') as f:
|
29
|
+
f.write(str(last_uploaded))
|
43
30
|
|
44
31
|
|
45
32
|
def upload(report):
|
@@ -51,7 +38,7 @@ def upload(report):
|
|
51
38
|
ctx = ssl.create_default_context()
|
52
39
|
ctx.load_cert_chain(certfile=config[':ssl_cert'], keyfile=config[':ssl_key'])
|
53
40
|
if config[':ssl_ca']:
|
54
|
-
|
41
|
+
ctx.load_verify_locations(cafile=config[':ssl_ca'])
|
55
42
|
connection = HTTPSConnection(config[':host'],
|
56
43
|
port=config[':port'], context=ctx)
|
57
44
|
else:
|
@@ -68,7 +55,7 @@ def upload(report):
|
|
68
55
|
|
69
56
|
if response.status == 200:
|
70
57
|
write_last_uploaded(report['job']['job_id'])
|
71
|
-
info_msg = 'Success {
|
58
|
+
info_msg = 'Success {}: {}'.format(report['job']['job_id'], response.read())
|
72
59
|
log.info(info_msg)
|
73
60
|
else:
|
74
61
|
log.error("Unable to upload job - aborting report upload")
|
@@ -107,7 +94,7 @@ def get_lock():
|
|
107
94
|
if os.path.isfile(LOCK_FILE):
|
108
95
|
raise Exception("Unable to obtain lock.")
|
109
96
|
else:
|
110
|
-
|
97
|
+
open(LOCK_FILE, 'w+').close()
|
111
98
|
|
112
99
|
|
113
100
|
def release_lock():
|
@@ -131,4 +118,3 @@ def now(highstate):
|
|
131
118
|
log.error('Exception encountered: %s', exc)
|
132
119
|
finally:
|
133
120
|
release_lock()
|
134
|
-
|
data/sbin/upload-salt-reports
CHANGED
metadata
CHANGED
@@ -1,15 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: smart_proxy_salt
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 6.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Michael Moll
|
8
8
|
- Stephen Benjamin
|
9
|
-
autorequire:
|
10
9
|
bindir: bin
|
11
10
|
cert_chain: []
|
12
|
-
date:
|
11
|
+
date: 1980-01-02 00:00:00.000000000 Z
|
13
12
|
dependencies:
|
14
13
|
- !ruby/object:Gem::Dependency
|
15
14
|
name: smart_proxy_dynflow
|
@@ -37,8 +36,8 @@ executables:
|
|
37
36
|
- foreman-node
|
38
37
|
extensions: []
|
39
38
|
extra_rdoc_files:
|
40
|
-
- README.md
|
41
39
|
- LICENSE
|
40
|
+
- README.md
|
42
41
|
files:
|
43
42
|
- LICENSE
|
44
43
|
- README.md
|
@@ -70,9 +69,8 @@ files:
|
|
70
69
|
- settings.d/salt.yml.example
|
71
70
|
homepage: https://github.com/theforeman/smart_proxy_salt
|
72
71
|
licenses:
|
73
|
-
- GPL-3.0
|
72
|
+
- GPL-3.0-only
|
74
73
|
metadata: {}
|
75
|
-
post_install_message:
|
76
74
|
rdoc_options: []
|
77
75
|
require_paths:
|
78
76
|
- lib
|
@@ -90,8 +88,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
90
88
|
- !ruby/object:Gem::Version
|
91
89
|
version: '0'
|
92
90
|
requirements: []
|
93
|
-
rubygems_version: 3.
|
94
|
-
signing_key:
|
91
|
+
rubygems_version: 3.6.7
|
95
92
|
specification_version: 4
|
96
93
|
summary: SaltStack Plug-In for Foreman's Smart Proxy
|
97
94
|
test_files: []
|