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

Fix String value issues in grub_config #46

Merged
merged 1 commit into from
Aug 28, 2019

Conversation

trevor-vaughan
Copy link
Contributor

  • Ensure that Boolean values are converted to Strings
  • Ensure the String values have quotes around them if not already
    present

Fixes #44, #45

* Ensure that Boolean values are converted to Strings
* Ensure the String values have quotes around them if not already
  present

Fixes voxpupuli#44, voxpupuli#45
@trevor-vaughan
Copy link
Contributor Author

@raphink Up for a review?

@@ -66,6 +66,12 @@ def value
end

def value=(newval)
if newval.is_a?(String)
unless %w[' "].include?(newval[0].chr)
newval = %Q("#{newval}")
Copy link
Member

Choose a reason for hiding this comment

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

I don't understand what you're doing here

Copy link
Contributor Author

@trevor-vaughan trevor-vaughan Aug 5, 2019

Choose a reason for hiding this comment

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

@raphink Ensuring that we don't quote strings that already start with quotes

Copy link
Member

Choose a reason for hiding this comment

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

Oh I see, %Q("") adds literal quotes while interpreting #{newval}.

Copy link
Member

Choose a reason for hiding this comment

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

iirc, there's a a quote_it function in augeasproviders_core, which is used in the shellvar module.

end

def insync?(is)
if is.is_a?(String) && should.is_a?(String)
Copy link
Member

Choose a reason for hiding this comment

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

At some point, we should probably rewrite augeasproviders with the new Resource API to natively support data types.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'd be curious to see how that works out. From what I've seen, easy things are easy and advanced things are nigh impossible (might be missing something though).

Copy link
Member

Choose a reason for hiding this comment

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

That was my feeling as well. @DavidS assured me otherwise though…

Copy link

@DavidS DavidS Aug 5, 2019

Choose a reason for hiding this comment

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

looking over the grub_config type and provider, the following things can't be handled by the Resource API:

Copy link
Member

Choose a reason for hiding this comment

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

Copy link

Choose a reason for hiding this comment

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

The instances method seems to be fine - that's a regular get, collecting and computing all the resources.

I didn't fully read through the handler sharing, but you should be able to share any instances you need across providers by directly reaching into other ruby namespaces. No need to load something into the catalog for that.

@tparkercbn
Copy link
Contributor

Hello. I'm wondering when this will be merged to master and pushed to the forge?

Thank you

Tom

@raphink raphink merged commit 4a5e625 into voxpupuli:master Aug 28, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

grub_config values with spaces cause augeas errors
4 participants