Option to disable ssl verification
diff --git a/_modules/artifactory_repo.py b/_modules/artifactory_repo.py
index 2efa12b..a97d215 100644
--- a/_modules/artifactory_repo.py
+++ b/_modules/artifactory_repo.py
@@ -50,7 +50,8 @@
'search_repos': 'repositories',
'username': 'your-user',
'password': 'password',
- 'headers': {'Content-type': 'application/json'}
+ 'headers': {'Content-type': 'application/json'},
+ 'ssl_verify': True
}
client_config.update(config)
@@ -65,7 +66,7 @@
query = "%s/%s/%s" % (self.artifactory_url, self.search_repos, name)
auth = (self.username, self.password)
- r = requests.put(query, auth=auth, json=config)
+ r = requests.put(query, auth=auth, json=config, verify=self.ssl_verify)
print(r.content)
raw_response = self.query_artifactory(query)
@@ -116,9 +117,9 @@
query_type = query_type.lower()
if query_type == "get":
- response = requests.get(query, auth=auth, headers=self.headers)
+ response = requests.get(query, auth=auth, headers=self.headers, verify=self.ssl_verify)
elif query_type == "put":
- response = requests.put(query, data=query.split('?', 1)[1], auth=auth, headers=self.headers)
+ response = requests.put(query, data=query.split('?', 1)[1], auth=auth, headers=self.headers, verify=self.ssl_verify)
if query_type == "post":
pass
@@ -226,7 +227,8 @@
__salt__['config.get'](prefix, {})).get(key, default)
client_config = {
- 'artifactory_url': '%s://%s:%s/artifactory/api' % (get('proto', 'http'), get('host', 'localhost'), get('port', '8080'))
+ 'artifactory_url': '%s://%s:%s/artifactory/api' % (get('proto', 'http'), get('host', 'localhost'), get('port', '8080')),
+ 'ssl_verify': get('ssl_verify', True)
}
user = get('user', False)
diff --git a/artifactory/files/_artifactory.conf b/artifactory/files/_artifactory.conf
index d9457ec..92e5f84 100644
--- a/artifactory/files/_artifactory.conf
+++ b/artifactory/files/_artifactory.conf
@@ -3,6 +3,7 @@
host: {{ client.server.host }}
port: {{ client.server.port }}
proto: {{ client.server.proto|default('http') }}
+ ssl_verify: {{ client.server.ssl_verify|default(True) }}
{%- if client.server.user is defined %}
user: {{ client.server.user }}
password: {{ client.server.password }}