promote develop to master #6
@ -24,16 +24,8 @@ def build_query(node=None, fact_name=None, match=None, show_role=False):
|
||||
return json.dumps(["and"] + query_filters)
|
||||
|
||||
def query_puppetdb(query):
|
||||
# Determine the correct SSL certificate path based on the OS
|
||||
if os.path.exists('/etc/ssl/certs/ca-certificates.crt'): # Debian/Ubuntu
|
||||
cert_path = '/etc/ssl/certs/ca-certificates.crt'
|
||||
elif os.path.exists('/etc/pki/tls/cert.pem'): # RHEL/CentOS
|
||||
cert_path = '/etc/pki/tls/cert.pem'
|
||||
else:
|
||||
raise FileNotFoundError("SSL certificate file not found.")
|
||||
|
||||
url = 'https://puppetdbapi.main.unkin.net/pdb/query/v4/facts'
|
||||
response = requests.get(url, params={'query': query}, verify=cert_path)
|
||||
url = 'http://puppetdbapi.service.consul:8080/pdb/query/v4/facts'
|
||||
response = requests.get(url, params={'query': query})
|
||||
process_response(response)
|
||||
|
||||
def process_response(response):
|
||||
|
||||
Loading…
Reference in New Issue
Block a user