Skip to content

Commit

Permalink
Merge pull request #599 from tonytan4ever/INSIGHTS-227-Autoloading-os…
Browse files Browse the repository at this point in the history
…cert

Autoload OS_CACERT environment variable
  • Loading branch information
tonytan4ever authored Dec 6, 2018
2 parents b2e8b82 + 4305847 commit 3447bc9
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 0 deletions.
12 changes: 12 additions & 0 deletions inventory/rpcr_dynamic_inventory.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ class RPCRMaasInventory(MaasInventory):
def __init__(self):
# Load stackrc environment variable file
self.load_stackrc_file()
self.load_os_cacert()
super(RPCRMaasInventory, self).__init__()

def read_input_inventory(self):
Expand Down Expand Up @@ -91,6 +92,17 @@ def load_stackrc_file(self):
v = match.group('value').strip('"').strip("'")
os.environ[k] = v

def load_os_cacert(self):
os_cert_path = '/etc/pki/ca-trust/source/anchors/'
if os.path.exists(os_cert_path):
# load the cert file in this directory
certs = []
for f in os.listdir(os_cert_path):
f_path = os.path.join(os_cert_path, f)
if os.path.isfile(f_path):
certs.append(f_path)
os.environ['OS_CACERT'] = ' '.join(certs)

def get_tripleo_plan_name(self):
oss_command = 'stack list -f json'
stack_list_result = self.run_oss_command(oss_command)
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
---
features:
- |
The rpcr-dynamic inventory now is able to set OS_CACERT environment
variable automatically.
upgrade:
- |
Deployment process can skip the step setting OS_CACERT.

0 comments on commit 3447bc9

Please sign in to comment.