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

Fixing empty user/password issue #972

Merged

Conversation

ajardan
Copy link

@ajardan ajardan commented Aug 14, 2017

With empty strings the template has the --user and --password options, but those are empty.

@igalic
Copy link
Contributor

igalic commented Aug 14, 2017

[2] pry(main)> pw = ''
=> ""
[3] pry(main)> if pw then :true else :false end
=> :true
[4] pry(main)> 

indeed. @ajardan how will this impact the other backup methods / templates?
they have the same defaults, and should possibly get the same treatment…

from what i gather, the easiest would perhaps even be to not give it any default at all, since a backupuser / backuppassword is always required. or?


this is the erlang school of thought

stop worrying and let it crash

of course in our case it doesn't crash. the puppet compiler catches your empty backupuser, which needs a parameter, and bails with an appropriate message. This is much better than let it crash, since it happens at compile time, and not at run-time…

@ajardan
Copy link
Author

ajardan commented Aug 14, 2017

@igalic for xtrabackup it is not required, since this doesn't need a MySQL connection. But it is required for mysqldump, so the other 2 methods are fine.

And yes, I agree, would be better to keep them all undef, and require/fail wherever it is necessary to perform the backup.

@igalic
Copy link
Contributor

igalic commented Aug 14, 2017

could you please update your commit message to explain this.

$backupuser = '',
$backuppassword = '',
$backupuser = undef,
$backuppassword = undef,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems like this might be a good chance to start using types and label these as Optional[String].

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

here it would be okay

but not in the other backup classes.

innobackupex command (which is used by xtrabackup) does not require a username
and a password, so those could be undefined. Since in the mysql::backup::xtrabackup
those were defined as empty strings, and in the template we only check if the
variable is defined, it results in a script that has the --user and --pasword
set, but no actual credentials, which breaks it.

Other backup providers are not affected, since a username and password are required.
@ajardan ajardan force-pushed the fix_empty_userpass_xtrabackup_template branch from 2541814 to 9d8d30f Compare August 14, 2017 13:16
@ajardan
Copy link
Author

ajardan commented Aug 14, 2017

@igalic I updated my commit message.

@rnelson0 I would be happy to do so, but we are still using Puppet 3.8.x, and I guess data types are part of Puppet 4.x ?

@rnelson0
Copy link
Contributor

@ajardan Data types are available in Puppet 3 with the future parser.

@hunner hunner merged commit 9d8d30f into puppetlabs:master Aug 15, 2017
hunner added a commit that referenced this pull request Aug 15, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants