File step-ca-has-provisioner of Package step-ca

#!/usr/bin/python3
# LICENSED UNDER AGPL 3.0
import json
import sys
import os.path

pathname='/var/lib/step-ca/.step/config/ca.json'

needle=sys.argv[1]
print('Searching for {needle}'.format(needle=needle))

if os.path.exists(pathname):
  with open(pathname) as open_file:
    parsed_config=json.load(open_file)
    provisioners= parsed_config['authority']['provisioners']
    for provisioner in provisioners:
      if provisioner['name'] == needle:
        print("Found the provisioner {needle}\n".format(needle=needle))
        sys.exit(0)
print("Did not find {needle}\n".format(needle=needle))
sys.exit(1)
openSUSE Build Service is sponsored by