Returns the config values from the config file scoped to the current profile. The configuration data is loaded **only** from the config file. It does not resolve variables based on different locations (e.g. first from the session instance, then from environm
(self)
| 344 | return copy.copy(self._session_instance_vars) |
| 345 | |
| 346 | def get_scoped_config(self): |
| 347 | """ |
| 348 | Returns the config values from the config file scoped to the current |
| 349 | profile. |
| 350 | |
| 351 | The configuration data is loaded **only** from the config file. |
| 352 | It does not resolve variables based on different locations |
| 353 | (e.g. first from the session instance, then from environment |
| 354 | variables, then from the config file). If you want this lookup |
| 355 | behavior, use the ``get_config_variable`` method instead. |
| 356 | |
| 357 | Note that this configuration is specific to a single profile (the |
| 358 | ``profile`` session variable). |
| 359 | |
| 360 | If the ``profile`` session variable is set and the profile does |
| 361 | not exist in the config file, a ``ProfileNotFound`` exception |
| 362 | will be raised. |
| 363 | |
| 364 | :raises: ConfigNotFound, ConfigParseError, ProfileNotFound |
| 365 | :rtype: dict |
| 366 | |
| 367 | """ |
| 368 | profile_name = self.get_config_variable('profile') |
| 369 | profile_map = self._build_profile_map() |
| 370 | # If a profile is not explicitly set return the default |
| 371 | # profile config or an empty config dict if we don't have |
| 372 | # a default profile. |
| 373 | if profile_name is None: |
| 374 | return profile_map.get('default', {}) |
| 375 | elif profile_name not in profile_map: |
| 376 | # Otherwise if they specified a profile, it has to |
| 377 | # exist (even if it's the default profile) otherwise |
| 378 | # we complain. |
| 379 | raise ProfileNotFound(profile=profile_name) |
| 380 | else: |
| 381 | return profile_map[profile_name] |
| 382 | |
| 383 | @property |
| 384 | def full_config(self): |
no test coverage detected