Skip to content

Commit 4305847

Browse files
author
tonytan4ever
committed
Autoload OS_CACERT environment variable
1 parent b2e8b82 commit 4305847

File tree

2 files changed

+20
-0
lines changed

2 files changed

+20
-0
lines changed

inventory/rpcr_dynamic_inventory.py

+12
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ class RPCRMaasInventory(MaasInventory):
4343
def __init__(self):
4444
# Load stackrc environment variable file
4545
self.load_stackrc_file()
46+
self.load_os_cacert()
4647
super(RPCRMaasInventory, self).__init__()
4748

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

95+
def load_os_cacert(self):
96+
os_cert_path = '/etc/pki/ca-trust/source/anchors/'
97+
if os.path.exists(os_cert_path):
98+
# load the cert file in this directory
99+
certs = []
100+
for f in os.listdir(os_cert_path):
101+
f_path = os.path.join(os_cert_path, f)
102+
if os.path.isfile(f_path):
103+
certs.append(f_path)
104+
os.environ['OS_CACERT'] = ' '.join(certs)
105+
94106
def get_tripleo_plan_name(self):
95107
oss_command = 'stack list -f json'
96108
stack_list_result = self.run_oss_command(oss_command)
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
---
2+
features:
3+
- |
4+
The rpcr-dynamic inventory now is able to set OS_CACERT environment
5+
variable automatically.
6+
upgrade:
7+
- |
8+
Deployment process can skip the step setting OS_CACERT.

0 commit comments

Comments
 (0)