diff options
author | Amjith Ramanujam <amjith.r@gmail.com> | 2018-07-26 17:17:35 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-07-26 17:17:35 -0700 |
commit | f12b472f4935577611d51b1ce14fb8b67886b5ff (patch) | |
tree | ca04313d6e5703f8698cd1f3f7a59c9ace8fb447 | |
parent | 688f09c0916841d16697bc71b474b878830a83f8 (diff) | |
parent | c48a68c2bd6835ac233952360a0499b3a35d0035 (diff) |
Merge pull request #927 from dbcli/j-bennet/keyring-honor-config
Fixes keyring = False not honored.
-rw-r--r-- | changelog.rst | 1 | ||||
-rw-r--r-- | pgcli/main.py | 6 |
2 files changed, 4 insertions, 3 deletions
diff --git a/changelog.rst b/changelog.rst index f2dc938f..653d6f9b 100644 --- a/changelog.rst +++ b/changelog.rst @@ -6,6 +6,7 @@ Bug fixes: * Fix for error retrieving version in Redshift (#922). (Thanks: `Irina Truong`_) * Adapt the query used to get functions metadata to PG11 (#919). (Thanks: `Lele Gaifax`_). +* Fix for keyring not disabled properly (#920). (Thanks: `Irina Truong`_) 1.10.2 ====== diff --git a/pgcli/main.py b/pgcli/main.py index da17abf6..4219930f 100644 --- a/pgcli/main.py +++ b/pgcli/main.py @@ -179,6 +179,7 @@ class PGCli(object): self.on_error = c['main']['on_error'].upper() self.decimal_format = c['data_formats']['decimal'] self.float_format = c['data_formats']['float'] + self.keyring_enabled = c["main"].as_bool("keyring") self.pgspecial.pset_pager(self.config['main'].as_bool( 'enable_pager') and "on" or "off") @@ -263,7 +264,6 @@ class PGCli(object): msg += '\nCurrently set to: %s' % self.table_format yield (None, None, None, msg) - def info_connection(self, **_): if self.pgexecute.host.startswith('/'): host = 'socket "%s"' % self.pgexecute.host @@ -424,7 +424,7 @@ class PGCli(object): - prepare keyring as described at: https://keyring.readthedocs.io/en/stable/ - uninstall keyring: pip uninstall keyring - disable keyring in our configuration: add keyring = False to [main]""") - if not passwd and keyring and self.config["main"].get("keyring", True): + if not passwd and keyring and self.keyring_enabled: try: passwd = keyring.get_password('pgcli', key) except ( @@ -472,7 +472,7 @@ class PGCli(object): **kwargs) else: raise e - if passwd and keyring and self.config["main"].get("keyring", True): + if passwd and keyring and self.keyring_enabled: try: keyring.set_password('pgcli', key, passwd) except ( |