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 ruby Symbol regex handler. #288

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Conversation

mvsm
Copy link

@mvsm mvsm commented Sep 24, 2020

Pull Request (PR) description

The goal of this pull request is to fix the regex in place to handle ruby symbols. It was not handling it properly, always outputting ":undef".

This Pull Request (PR) fixes the following issues

Fixes #289.

Thanks!

@mvsm mvsm force-pushed the master branch 7 times, most recently from f806dc9 to 143f20a Compare September 24, 2020 18:54
Copy link
Member

@kenyon kenyon left a comment

Choose a reason for hiding this comment

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

What is causing these formatting changes? It's a bit difficult to see the actual changes when formatting changes are mixed in.

@mvsm
Copy link
Author

mvsm commented Sep 24, 2020

I fixed to pass the CI configuration. It was complaining and not passing all checks. I can undo them if required.

Copy link
Member

@kenyon kenyon left a comment

Choose a reason for hiding this comment

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

The linting changes probably don't need to be undone, but it's nice to have them in a separate commit for ease of review. I'm not too familiar with this module, so we'll let someone else review, but otherwise this looks OK to me.

@@ -228,7 +225,7 @@
# catch that error here and notify the user
$missing_backends = difference($backends, keys($backend_data))
if count($missing_backends) > 0 {
fail("The supplied backends: ${missing_backends} are missing from the backend_options hash:\n ${backend_options}\n
fail("The supplied backends: ${missing_backends} are missing from the backend_options hash:\n ${backend_options}\n
Copy link
Member

Choose a reason for hiding this comment

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

This seems like worse formatting, the indentation doesn't line up.

Copy link
Author

Choose a reason for hiding this comment

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

I agree. I just followed the CI (history here https://travis-ci.org/github/voxpupuli/puppet-hiera/pull_requests) until it was all green.

Copy link
Author

Choose a reason for hiding this comment

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

I can undo the changes and separate into two different commits, I really don't mind. I sent as one commit because some repos only accept pull requests with one commit. Regardless, it is your call, I just want to help! =)

Copy link
Member

@ghoneycutt ghoneycutt left a comment

Choose a reason for hiding this comment

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

Could you please add a test that currently fails and will pass after this change to demonstrate the issue with the regexp?

Also regexp's are hard to read and understand what the author's intentions are. Could you please add a comment to the erb that explains what this is attempting to match.

<%-# This is a sample comment! %>

@mvsm
Copy link
Author

mvsm commented Sep 25, 2020

I can add the test and the comments. I will open an issue with the test case, is that OK?

Copy link
Contributor

@igalic igalic left a comment

Choose a reason for hiding this comment

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

🙋🏻‍♀️

'backend_options' => {
'json' => {
'datadir' => '/etc/puppet/json_data/data'
},
'yamll' => {
'datadir' => '/etc/puppet/yamll_data/data'
},
'redis' => {
'deserialize' => '!ruby/sym json'
}
Copy link
Contributor

Choose a reason for hiding this comment

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

is adding this backend the reason for this pr?
it's not clear from the title and I'm so confused about half of these changes

Copy link
Author

@mvsm mvsm Sep 25, 2020

Choose a reason for hiding this comment

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

The reason behind the changes is because the regex to parse symbols is not working properly. This backend is a test case (that also is mentioned in the readme). When I was actually trying to use the mechanism to convert the value into a symbol, the output of this '!ruby/sym json' was becoming this ':undef'. The changes were only on the template file, everything else was because the CI was requesting formating to pass, I can revert them, but you will need to fix the CI or accept without a green ack.

@mvsm mvsm changed the title Fixing ruby Symbol regex handle. Fixing ruby Symbol regex handler. Sep 25, 2020
@mvsm
Copy link
Author

mvsm commented Sep 25, 2020

I formally created an issue (#289), I just can't link it.

Copy link
Contributor

@igalic igalic left a comment

Choose a reason for hiding this comment

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

there's a lot of whitespace changes to please the linter, which i don't agree with
what i do agree with is the code changes

@mvsm
Copy link
Author

mvsm commented Oct 6, 2020

Any news?

@vox-pupuli-tasks
Copy link

Dear @mvsm, thanks for the PR!

This is Vox Pupuli Tasks, your friendly Vox Pupuli GitHub Bot. I noticed that your pull request contains merge conflict. Can you please rebase?

You can find my sourcecode at voxpupuli/vox-pupuli-tasks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Module fails to parse backend values when they are ruby symbols
4 participants