-
Notifications
You must be signed in to change notification settings - Fork 614
Cleanup useless $connect_setting validation #1487
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -37,7 +37,7 @@ | |
) { | ||
# If possible use the version of the remote database, otherwise | ||
# fallback to our local DB version | ||
if $connect_settings != undef and 'DBVERSION' in $connect_settings { | ||
if 'DBVERSION' in $connect_settings { | ||
$version = $connect_settings['DBVERSION'] | ||
} else { | ||
$version = $postgresql::server::_version | ||
|
@@ -62,15 +62,15 @@ | |
# | ||
# Port, order of precedence: $port parameter, $connect_settings[PGPORT], $postgresql::server::port | ||
# | ||
if $port != undef { | ||
if $port { | ||
$port_override = $port | ||
} elsif $connect_settings != undef and 'PGPORT' in $connect_settings { | ||
} elsif 'PGPORT' in $connect_settings { | ||
$port_override = undef | ||
} else { | ||
$port_override = $postgresql::server::port | ||
} | ||
|
||
if $target_role != undef { | ||
if $target_role { | ||
Ramesh7 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
$_target_role = " FOR ROLE ${target_role}" | ||
$_check_target_role = "/${target_role}" | ||
} else { | ||
|
@@ -178,11 +178,11 @@ | |
environment => 'PGOPTIONS=--client-min-messages=error', | ||
} | ||
|
||
if($role != undef and defined(Postgresql::Server::Role[$role])) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
if defined(Postgresql::Server::Role[$role]) { | ||
Postgresql::Server::Role[$role] -> Postgresql_psql["default_privileges:${name}"] | ||
} | ||
|
||
if($db != undef and defined(Postgresql::Server::Database[$db])) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
if defined(Postgresql::Server::Database[$db]) { | ||
Postgresql::Server::Database[$db] -> Postgresql_psql["default_privileges:${name}"] | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -77,9 +77,9 @@ | |
# | ||
# Port, order of precedence: $port parameter, $connect_settings[PGPORT], $postgresql::server::port | ||
# | ||
if $port != undef { | ||
if $port { | ||
$port_override = $port | ||
} elsif $connect_settings != undef and 'PGPORT' in $connect_settings { | ||
} elsif 'PGPORT' in $connect_settings { | ||
Comment on lines
-80
to
+82
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Here it makes sense because $port is undef by default |
||
$port_override = undef | ||
} else { | ||
$port_override = $postgresql::server::port | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -77,7 +77,7 @@ | |
# | ||
# Port, order of precedence: $port parameter, $connect_settings[PGPORT], $postgresql::server::port | ||
# | ||
if $port != undef { | ||
if $port { | ||
$port_override = $port | ||
} elsif $connect_settings != undef and 'PGPORT' in $connect_settings { | ||
$port_override = undef | ||
Comment on lines
-80
to
83
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. whole block doesn't make sense because |
||
|
@@ -483,11 +483,11 @@ | |
onlyif => $_onlyif, | ||
} | ||
|
||
if($role != undef and defined(Postgresql::Server::Role[$role])) { | ||
if defined(Postgresql::Server::Role[$role]) { | ||
Postgresql::Server::Role[$role] -> Postgresql_psql["grant:${name}"] | ||
} | ||
|
||
if($db != undef and defined(Postgresql::Server::Database[$db])) { | ||
if defined(Postgresql::Server::Database[$db]) { | ||
Postgresql::Server::Database[$db] -> Postgresql_psql["grant:${name}"] | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -53,17 +53,17 @@ | |
# | ||
# Port, order of precedence: $port parameter, $connect_settings[PGPORT], $postgresql::server::port | ||
# | ||
if $port != undef { | ||
if $port { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Bit of confusing for me due to the priority changing in each file, not sure its expected. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. In this case, the priority doesn't change. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think this is fine to merge because it only simplifies the code, it doesn't change the logic. but the logic is broken and should probably be checked in a dedicated issue. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. #1469 was aimed at making it more consistent. I haven't checked back on the most recent implementation, but you're right that it is inconsistent between files. |
||
$port_override = $port | ||
} elsif $connect_settings != undef and 'PGPORT' in $connect_settings { | ||
} elsif 'PGPORT' in $connect_settings { | ||
$port_override = undef | ||
} else { | ||
$port_override = $postgresql::server::port | ||
} | ||
|
||
# If possible use the version of the remote database, otherwise | ||
# fallback to our local DB version | ||
if $connect_settings != undef and 'DBVERSION' in $connect_settings { | ||
if 'DBVERSION' in $connect_settings { | ||
$version = $connect_settings['DBVERSION'] | ||
} else { | ||
$version = $postgresql::server::_version | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the whole block doesn't make sense? Port is always set and cannot be undef. so
$port_override
is always set to$port
? I don't thinky anybody uses$connect_settings
. The whole setup seems broken?