(self, config_dict)
| 171 | self._config_file = config_file |
| 172 | |
| 173 | def _parse_config(self, config_dict): |
| 174 | if not config_dict: |
| 175 | return {}, None |
| 176 | |
| 177 | current_context = config_dict["current-context"] |
| 178 | if current_context is None: |
| 179 | return {}, None |
| 180 | |
| 181 | contexts = {} |
| 182 | current_context_exists = False |
| 183 | for c in config_dict["contexts"]: |
| 184 | if current_context == c["name"]: |
| 185 | current_context_exists = True |
| 186 | contexts[c["name"]] = Context.from_dict(c) |
| 187 | |
| 188 | if not current_context_exists: |
| 189 | raise RuntimeError( |
| 190 | "Current context {0} is not exists in config file {1}".format( |
| 191 | current_context, GS_CONFIG_DEFAULT_LOCATION |
| 192 | ) |
| 193 | ) |
| 194 | |
| 195 | return contexts, current_context |
| 196 | |
| 197 | def load_config(self): |
| 198 | config_dict = read_yaml_file(self._config_file) |
no test coverage detected