mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-23 19:56:01 +00:00
Merge pull request #48351 from juju-solutions/bug/get-pass
Automatic merge from submit-queue (batch tested with PRs 48317, 48313, 48351, 48357, 48115) Ensure get_password is accessing a file that exists. **What this PR does / why we need it**: get_password will throw an exception instead of returning None in case the basic_auth.csv file is missing but /root/cdk/ is there in a juju deployment. **Which issue this PR fixes** *(optional, in `fixes #<issue number>(, fixes #<issue_number>, ...)` format, will close that issue when PR gets merged)*: fixes https://github.com/juju-solutions/bundle-canonical-kubernetes/issues/324 **Special notes for your reviewer**: **Release note**: ``` Fix race condition where /root/cdk is not yet initialised in kubernetes-master setup by Juju ```
This commit is contained in:
commit
dc597291c1
@ -920,9 +920,9 @@ def setup_tokens(token, username, user):
|
||||
def get_password(csv_fname, user):
|
||||
'''Get the password of user within the csv file provided.'''
|
||||
root_cdk = '/root/cdk'
|
||||
if not os.path.isdir(root_cdk):
|
||||
return None
|
||||
tokens_fname = os.path.join(root_cdk, csv_fname)
|
||||
if not os.path.isfile(tokens_fname):
|
||||
return None
|
||||
with open(tokens_fname, 'r') as stream:
|
||||
for line in stream:
|
||||
record = line.split(',')
|
||||
|
Loading…
Reference in New Issue
Block a user