|
13 | 13 |
|
14 | 14 | """OpenStackConfig subclass for argument compatibility""" |
15 | 15 |
|
16 | | -from os_client_config import exceptions as occ_exceptions |
17 | 16 | from osc_lib.cli import client_config |
18 | 17 |
|
19 | 18 |
|
@@ -70,70 +69,3 @@ def load_auth_plugin(self, config): |
70 | 69 | config = self._validate_auth(config, loader) |
71 | 70 | auth_plugin = loader.load_from_options(**config['auth']) |
72 | 71 | return auth_plugin |
73 | | - |
74 | | - # TODO(dtroyer): Remove _validate_auth_ksc when it is in osc-lib 1.3.0 |
75 | | - def _validate_auth_ksc(self, config, cloud, fixed_argparse=None): |
76 | | - """Old compatibility hack for OSC, no longer needed/wanted""" |
77 | | - return config |
78 | | - |
79 | | - # TODO(dtroyer): Remove _validate_auth when it is in osc-lib 1.3.0 |
80 | | - def _validate_auth(self, config, loader, fixed_argparse=None): |
81 | | - """Validate auth plugin arguments""" |
82 | | - # May throw a keystoneauth1.exceptions.NoMatchingPlugin |
83 | | - |
84 | | - plugin_options = loader.get_options() |
85 | | - |
86 | | - msgs = [] |
87 | | - prompt_options = [] |
88 | | - for p_opt in plugin_options: |
89 | | - # if it's in config, win, move it and kill it from config dict |
90 | | - # if it's in config.auth but not in config we're good |
91 | | - # deprecated loses to current |
92 | | - # provided beats default, deprecated or not |
93 | | - winning_value = self._find_winning_auth_value(p_opt, config) |
94 | | - if not winning_value: |
95 | | - winning_value = self._find_winning_auth_value( |
96 | | - p_opt, config['auth']) |
97 | | - |
98 | | - # if the plugin tells us that this value is required |
99 | | - # then error if it's doesn't exist now |
100 | | - if not winning_value and p_opt.required: |
101 | | - msgs.append( |
102 | | - 'Missing value {auth_key}' |
103 | | - ' required for auth plugin {plugin}'.format( |
104 | | - auth_key=p_opt.name, plugin=config.get('auth_type'), |
105 | | - ) |
106 | | - ) |
107 | | - |
108 | | - # Clean up after ourselves |
109 | | - for opt in [p_opt.name] + [o.name for o in p_opt.deprecated]: |
110 | | - opt = opt.replace('-', '_') |
111 | | - config.pop(opt, None) |
112 | | - config['auth'].pop(opt, None) |
113 | | - |
114 | | - if winning_value: |
115 | | - # Prefer the plugin configuration dest value if the value's key |
116 | | - # is marked as depreciated. |
117 | | - if p_opt.dest is None: |
118 | | - config['auth'][p_opt.name.replace('-', '_')] = ( |
119 | | - winning_value) |
120 | | - else: |
121 | | - config['auth'][p_opt.dest] = winning_value |
122 | | - |
123 | | - # See if this needs a prompting |
124 | | - if ( |
125 | | - 'prompt' in vars(p_opt) and |
126 | | - p_opt.prompt is not None and |
127 | | - p_opt.dest not in config['auth'] and |
128 | | - self._pw_callback is not None |
129 | | - ): |
130 | | - # Defer these until we know all required opts are present |
131 | | - prompt_options.append(p_opt) |
132 | | - |
133 | | - if msgs: |
134 | | - raise occ_exceptions.OpenStackConfigException('\n'.join(msgs)) |
135 | | - else: |
136 | | - for p_opt in prompt_options: |
137 | | - config['auth'][p_opt.dest] = self._pw_callback(p_opt.prompt) |
138 | | - |
139 | | - return config |
0 commit comments