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: ea43480d38aa6f8d3694e61899d0b5dadeacaacc775a82d8ab2a456810bb8bcd
4
- data.tar.gz: 6101554d6bf03679d29399f4ad92fbc51c4bfe1250e928433eca682ad015bac7
3
+ metadata.gz: fd14287d87c9ed2e41a86539f25b52f741549f20501b5f6dc7936075cca3fdad
4
+ data.tar.gz: af25b8597c836c1b5a8fd726612f6c49d05a87b50e877c19f42e2836d97c1717
5
5
  SHA512:
6
- metadata.gz: 9de7cddee069d666c6cc4a7400c2df16d647c4e244286a0376e8c1416555c85e1d295975017b28041305be31e2cbe02343c9da5e9688c8666b8141c0d1a8fbb1
7
- data.tar.gz: 30464b1b58712d5a022c49b4e104fe29e5b82ad44d356cd50d59fb3b54dca0ce6b8fc7ead55e93f6ecf193c24a04782a924fbc650129c570b4606bf04f5b4408
6
+ metadata.gz: ecdaa039f92b673ab76340da06d92397d01980baf5c7956687cd2314ff1e8e579af6beed07f1a966312c285adc30606895a3c1545ffb0e38b8a68bc087328b76
7
+ data.tar.gz: 23853c34472f6cbb3a674c5c88806167c5f6be692032ecc08a474ae335ad842e477ce8425a8ef35787878b51128bad278bf90bca014b3fbc5c6937062e297889
@@ -3,6 +3,6 @@
3
3
  module Proxy
4
4
  # Salt module
5
5
  module Salt
6
- VERSION = '5.1.0'
6
+ VERSION = '6.0.0'
7
7
  end
8
8
  end
@@ -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, 'r') as config_file:
23
- config = yaml.load(config_file.read())
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
- LAST_UPLOADED = '/etc/salt/last_uploaded'
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
- log = logging.getLogger(__name__)
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
- if sys.version_info.major == 3:
31
- unicode = str
18
+ log = logging.getLogger(__name__)
32
19
 
33
20
 
34
21
  def salt_config():
35
- with open(FOREMAN_CONFIG, 'r') as f:
36
- config = yaml.load(f.read())
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 io.open(LAST_UPLOADED, 'w+') as f:
42
- f.write(unicode(last_uploaded))
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
- ctx.load_verify_locations(cafile=config[':ssl_ca'])
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 {0}: {1}'.format(report['job']['job_id'], response.read())
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
- io.open(LOCK_FILE, 'w+').close()
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
-
@@ -28,7 +28,7 @@ if sys.version_info.major == 3:
28
28
 
29
29
  def salt_config():
30
30
  with io.open(FOREMAN_CONFIG, 'r') as f:
31
- config = yaml.load(f.read())
31
+ config = yaml.safe_load(f.read())
32
32
  return config
33
33
 
34
34
 
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: 5.1.0
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: 2024-04-17 00:00:00.000000000 Z
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.3.26
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: []