Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Db manager does not correctly retrieve the ssl mode of postgreSQL connections #37479

Closed
FERRATON opened this issue Jun 29, 2020 · 17 comments
Closed
Labels
Bug Either a bug report, or a bug fix. Let's hope for the latter! DB Manager Relating to the DB Manager core plugin Feedback Waiting on the submitter for answers stale Uh oh! Seems this work is abandoned, and the PR is about to close.

Comments

@FERRATON
Copy link

It's all in the title!

the cause of the error is on line 87 in
...\db_manager\db_plugins\postgis\plugin.py

I suggest replacing
try:
sslmode = settings.value("sslmode", QgsDataSourceUri.SslPrefer, type=int)
except TypeError:
sslmode = QgsDataSourceUri.SslPrefer
by
sslmode = settings.enumValue("sslmode", QgsDataSourceUri.SslPrefer)

@FERRATON FERRATON added the Bug Either a bug report, or a bug fix. Let's hope for the latter! label Jun 29, 2020
@gioman gioman added the DB Manager Relating to the DB Manager core plugin label Jun 29, 2020
@gioman
Copy link
Contributor

gioman commented Jun 29, 2020

I suggest replacing
try:
sslmode = settings.value("sslmode", QgsDataSourceUri.SslPrefer, type=int)
except TypeError:
sslmode = QgsDataSourceUri.SslPrefer
by
sslmode = settings.enumValue("sslmode", QgsDataSourceUri.SslPrefer)

@FERRATON can you propose a patch via PR?

@FERRATON
Copy link
Author

I'm sorry, I'm not familiar with the process.
Could someone do it for me?

@gioman
Copy link
Contributor

gioman commented Jun 30, 2020

Could someone do it for me?

@FERRATON let's ask first a developer if this patch is correct first. @elpaso what do think about?

@gioman gioman added the Feedback Waiting on the submitter for answers label Jun 30, 2020
@elpaso
Copy link
Contributor

elpaso commented Jul 1, 2020

Could someone do it for me?

@FERRATON let's ask first a developer if this patch is correct first. @elpaso what do think about?

Note that I'm commenting on the patch only, I didn't investigate the original issue.

I think that the patch is wrong: given the following configuration (SslDisable):

connections\docker%208.4\sslmode=1
QgsDataSourceUri.SslPrefer
Out[4]: 0

QgsDataSourceUri.SslDisable
Out[6]: 1

settings.beginGroup('/PostgreSQL/connections/docker 8.4')

settings.value("sslmode", QgsDataSourceUri.SslPrefer)
Out[8]: 1   # this is the expected value

settings.enumValue("sslmode", QgsDataSourceUri.SslPrefer)
Out[9]: 0  # this is wrong!

CC @3nids may know more about how this enumValue() is supposed to work.

@FERRATON
Copy link
Author

FERRATON commented Jul 1, 2020

for me (QGIS 3.10 windows) sslmode is not stored as an integer in QGIS3.ini but for example as :
connections\geobase_snum_etienne_lousteau_admin\sslmode=SslDisable

settings.value("sslmode", QgsDataSourceUri.SslPrefer) return 'SslDisable'
settings.enumValue("sslmode", QgsDataSourceUri.SslPrefer) return 1

@3nids
Copy link
Member

3nids commented Jul 1, 2020

connections\docker%208.4\sslmode=1

should be

connections\docker%208.4\sslmode=SslPrefer

@elpaso
Copy link
Contributor

elpaso commented Jul 1, 2020

Ok, so the patch looks good and we have a bug somewhere because I didn't forge connections\docker%208.4\sslmode=1 but I've just taken it from my QGIS.ini.

@elpaso
Copy link
Contributor

elpaso commented Jul 1, 2020

Update: I've found from where my sslmode=1 came from, see linked PR.

espinafre pushed a commit to espinafre/QGIS that referenced this issue Jul 3, 2020
@FERRATON
Copy link
Author

FERRATON commented Jul 6, 2020

so could someone please pass the patch for ... \ db_manager \ db_plugins \ postgis \ plugin.py ?

@github-actions
Copy link

The QGIS project highly values your report and would love to see it addressed. However, this issue has been left in feedback mode for the last 14 days and is being automatically marked as "stale".
If you would like to continue with this issue, please provide any missing information or answer any open questions. If you could resolve the issue yourself meanwhile, please leave a note for future readers with the same problem and close the issue.
In case you should have any uncertainty, please leave a comment and we will be happy to help you proceed with this issue.
If there is no further activity on this issue, it will be closed in a week.

@github-actions github-actions bot added the stale Uh oh! Seems this work is abandoned, and the PR is about to close. label Dec 22, 2020
@gioman
Copy link
Contributor

gioman commented Dec 22, 2020

so could someone please pass the patch for ... \ db_manager \ db_plugins \ postgis \ plugin.py ?

@FERRATON do you mean create the pull request?

@gioman gioman removed the stale Uh oh! Seems this work is abandoned, and the PR is about to close. label Dec 22, 2020
@FERRATON
Copy link
Author

Yes if it's possible. I don't have the experience to do it myself yet.

@Gustry
Copy link
Contributor

Gustry commented Dec 22, 2020

If it's short, you can edit straight from GitHub website, it will create the commit and PR for you.
There is a pen on each files.

FERRATON added a commit to FERRATON/QGIS that referenced this issue Dec 22, 2020
Backport qgis#37479 to 3.10 LTR
FERRATON added a commit to FERRATON/QGIS that referenced this issue Dec 22, 2020
Backport qgis#37479 to 3.10 LTR
@FERRATON
Copy link
Author

All right, thank you.
I see that the proposed change has already been pushed in the master and in version 3.16.
I have proposed a PR for 3.10

FERRATON added a commit to FERRATON/QGIS that referenced this issue Dec 22, 2020
backport patch of qgis#37479
@gioman
Copy link
Contributor

gioman commented Dec 27, 2020

I see that the proposed change has already been pushed in the master and in version 3.16.

@FERRATON closing then?

@github-actions
Copy link

The QGIS project highly values your report and would love to see it addressed. However, this issue has been left in feedback mode for the last 14 days and is being automatically marked as "stale".
If you would like to continue with this issue, please provide any missing information or answer any open questions. If you could resolve the issue yourself meanwhile, please leave a note for future readers with the same problem and close the issue.
In case you should have any uncertainty, please leave a comment and we will be happy to help you proceed with this issue.
If there is no further activity on this issue, it will be closed in a week.

@github-actions github-actions bot added the stale Uh oh! Seems this work is abandoned, and the PR is about to close. label Jan 11, 2021
@github-actions
Copy link

github-actions bot commented Feb 9, 2021

While we hate to see this happen, this Issue has been automatically closed because it has not had any activity in the last 42 days despite being marked as feedback. If this issue should be reconsidered, please follow the guidelines in the previous comment and reopen this issue.
Or, if you have any further questions, there are also further support channels that can help you.

@github-actions github-actions bot closed this as completed Feb 9, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Either a bug report, or a bug fix. Let's hope for the latter! DB Manager Relating to the DB Manager core plugin Feedback Waiting on the submitter for answers stale Uh oh! Seems this work is abandoned, and the PR is about to close.
Projects
None yet
Development

No branches or pull requests

5 participants