smart_proxy_salt 5.1.0 → 6.1.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: a197d5fdfffc912f35d6342a2b04384e35fd88a83de7c47c644c798521931ce5
4
+ data.tar.gz: 32ea0a30d5215bd86646cc36ae3b97915d3ad6c22bc70bd798f07f838c247c0b
5
5
  SHA512:
6
- metadata.gz: 9de7cddee069d666c6cc4a7400c2df16d647c4e244286a0376e8c1416555c85e1d295975017b28041305be31e2cbe02343c9da5e9688c8666b8141c0d1a8fbb1
7
- data.tar.gz: 30464b1b58712d5a022c49b4e104fe29e5b82ad44d356cd50d59fb3b54dca0ce6b8fc7ead55e93f6ecf193c24a04782a924fbc650129c570b4606bf04f5b4408
6
+ metadata.gz: 0a4d9ee99a8826789102b83094d5d38dc8adfc262d8ec360aec0cb15aecb7ae58aab4f6364cc6f721c0c03098a719acaf28caa57c26a038f3dd7637ad35d78cc
7
+ data.tar.gz: 29b88c7eba04cb207e68570f0a9d0809a97a3a6479c7bf85e57f0905a50836938bda78ec04c4ef9565434c4873aca0e4331dd031d7d321b27330ea3a49667af3
@@ -3,9 +3,9 @@
3
3
  :host: foreman.example.com
4
4
  :port: 443
5
5
  # if using http with ssl certificates
6
- :ssl_ca: "/var/lib/puppet/ssl/certs/ca.pem"
7
- :ssl_cert: "/var/lib/puppet/ssl/private_keys/foreman.example.com.pem"
8
- :ssl_key: "/var/lib/puppet/ssl/certs/foreman.example.com.pem"
6
+ :ssl_ca: "/etc/foreman-proxy/foreman_ssl_ca.pem"
7
+ :ssl_cert: "/etc/foreman-proxy/foreman_ssl_cert.pem"
8
+ :ssl_key: "/etc/foreman-proxy/foreman_ssl_key.pem"
9
9
  # if using http with username and password instead of https with certicates
10
10
  #:username: admin
11
11
  #:password: changeme
@@ -45,7 +45,7 @@ module Proxy
45
45
 
46
46
  def generate_command
47
47
  saltfile_path = ::Proxy::Salt::Plugin.settings[:saltfile]
48
- command = %w[salt --show-jid]
48
+ command = %w[sudo salt --show-jid]
49
49
  command << "--saltfile=#{saltfile_path}" if File.file?(saltfile_path)
50
50
  command << @options['name']
51
51
  command << 'state.template_str'
@@ -3,6 +3,6 @@
3
3
  module Proxy
4
4
  # Salt module
5
5
  module Salt
6
- VERSION = '5.1.0'
6
+ VERSION = '6.1.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.1.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
@@ -17,28 +16,36 @@ dependencies:
17
16
  requirements:
18
17
  - - "~>"
19
18
  - !ruby/object:Gem::Version
20
- version: '0.5'
21
- - - ">="
22
- - !ruby/object:Gem::Version
23
- version: 0.5.0
19
+ version: '0.8'
24
20
  type: :runtime
25
21
  prerelease: false
26
22
  version_requirements: !ruby/object:Gem::Requirement
27
23
  requirements:
28
24
  - - "~>"
29
25
  - !ruby/object:Gem::Version
30
- version: '0.5'
31
- - - ">="
26
+ version: '0.8'
27
+ - !ruby/object:Gem::Dependency
28
+ name: csv
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '3.1'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
32
39
  - !ruby/object:Gem::Version
33
- version: 0.5.0
40
+ version: '3.1'
34
41
  description: This plug-in adds support for Salt to Foreman's Smart Proxy
35
42
  email: foreman-dev@googlegroups.com
36
43
  executables:
37
44
  - foreman-node
38
45
  extensions: []
39
46
  extra_rdoc_files:
40
- - README.md
41
47
  - LICENSE
48
+ - README.md
42
49
  files:
43
50
  - LICENSE
44
51
  - README.md
@@ -70,9 +77,8 @@ files:
70
77
  - settings.d/salt.yml.example
71
78
  homepage: https://github.com/theforeman/smart_proxy_salt
72
79
  licenses:
73
- - GPL-3.0
80
+ - GPL-3.0-only
74
81
  metadata: {}
75
- post_install_message:
76
82
  rdoc_options: []
77
83
  require_paths:
78
84
  - lib
@@ -90,8 +96,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
90
96
  - !ruby/object:Gem::Version
91
97
  version: '0'
92
98
  requirements: []
93
- rubygems_version: 3.3.26
94
- signing_key:
99
+ rubygems_version: 3.6.9
95
100
  specification_version: 4
96
101
  summary: SaltStack Plug-In for Foreman's Smart Proxy
97
102
  test_files: []