@@ -30,26 +30,36 @@ def get_credentials(credential_filepath):
3030 with open (credential_filepath , 'r' ) as cred_file :
3131 credentials = json .load (cred_file )
3232
33- expected_sections = set (CREDENTIAL_KEYS .keys ())
33+ required_sections = {'aws' , 'gcp' }
34+ optional_sections = {'sdv' }
35+ valid_sections = required_sections | optional_sections
36+
3437 actual_sections = set (credentials .keys ())
35- if expected_sections != actual_sections :
38+ missing_required = required_sections - actual_sections
39+ unknown_sections = actual_sections - valid_sections
40+ if missing_required or unknown_sections :
3641 raise ValueError (
37- f'The credentials file must contain the following sections: { expected_sections } . '
38- f'Found: { actual_sections } .'
42+ f'Credentials file can only contain the following sections: { valid_sections } .'
3943 )
4044
41- for section , expected_keys in CREDENTIAL_KEYS .items ():
45+ for section in valid_sections :
46+ if section not in credentials :
47+ continue
48+
49+ expected_keys = CREDENTIAL_KEYS [section ]
4250 actual_keys = set (credentials [section ].keys ())
4351 if expected_keys != actual_keys :
4452 raise ValueError (
4553 f'The "{ section } " section must contain the following keys: { expected_keys } . '
4654 f'Found: { actual_keys } .'
4755 )
4856
57+ credentials .setdefault ('sdv' , {})
58+
4959 return credentials
5060
5161
52- def bundle_install_cmd (credentials ):
62+ def sdv_install_cmd (credentials ):
5363 sdv_creds = credentials .get ('sdv' ) or {}
5464 username = sdv_creds .get ('username' )
5565 license_key = sdv_creds .get ('license_key' )
0 commit comments