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

Recursively validate puppet parameter values #107

Merged
merged 1 commit into from Jun 15, 2013
Merged

Recursively validate puppet parameter values #107

merged 1 commit into from Jun 15, 2013

Conversation

adrienthebo
Copy link
Contributor

Puppet internally stringifies all values, which means that rspec
expectations with integers will fail because 1 != "1". This commit adds
a new parameter class, which can recursively validate a parameter and
ensure that structured data will be properly and recursively validated.

This is the first time that I've written any non-trivial amount of code for RSpec, so I have no idea if this is the most idiomatic or clear approach. I would love feedback on how to make this better or more effective.

@adrienthebo
Copy link
Contributor Author

Hmm, it looks like 2.6.17 is automatically flattening arrays. This may just be old behavior; I could mark this testing as pending on 2.6.17.

@rodjek
Copy link
Owner

rodjek commented May 22, 2013

Yeah, 2.6 and below automatically flattened arrays for what i'm sure are hysterical raisins.

Puppet internally stringifies all values, which means that rspec
expectations with integers will fail because 1 != "1". This commit adds
a new parameter class, which can recursively validate a parameter and
ensure that structured data will be properly and recursively validated.
@adrienthebo
Copy link
Contributor Author

I've added special casing for 2.6 (https://github.com/rodjek/rspec-puppet/pull/107/files#L2R43) to ensure that integers are correctly validated even if there's array flattening.

rodjek pushed a commit that referenced this pull request Jun 15, 2013
Recursively validate puppet parameter values
@rodjek rodjek merged commit 6aa05dc into rodjek:master Jun 15, 2013
@rodjek
Copy link
Owner

rodjek commented Jun 15, 2013

Love it, thanks!

@adrienthebo
Copy link
Contributor Author

Thanks for the merge!

@chqr
Copy link

chqr commented Jul 10, 2013

Is there any chance this could be released? I have a couple of places where I'd like to test hash parameters (on ruby 1.8.7), but the version of rspec-puppet in RubyGems doesn't have this feature. Apologies if there is an easy work-around I'm not aware of -- and thanks for providing such a useful tool!

@fcharlier
Copy link

+1, any Idea when this feature could be released ?

@adrienthebo adrienthebo deleted the recursive_param_compare branch October 7, 2013 06:10
@adrienthebo
Copy link
Contributor Author

@chqr @fcharlier If you're able to use Bundler for installing test dependencies you can pull this gem from git, like so: https://github.com/adrienthebo/puppet-network/blob/master/Gemfile#L19

openstack-gerrit pushed a commit to openstack/puppet-keystone that referenced this pull request Dec 3, 2013
Serving keystone from a wsgi container is recommended for production
setups. SSL is enabled by default.

See the following URLs for explanations:
    http://adam.younglogic.com/2012/03/keystone-should-move-to-apache-httpd/
    https://etherpad.openstack.org/havana-keystone-performance

Documentation in manifests/wsgi/apache.pp

Apache can be configured as a drop in replacement for keystone (using
    ports 5000 & 35357) or with paths using the standard SSL port. See
examples in examples/apache_*.pp

- Also change some 'real_' prefix into '_real' suffix to respect the
coding guide.
- Added the '--insecure' option to keystone client in the provider to
allow using self-signed certificates.
- Fixed parsing the ssl/enable value in the provider.

There is no integer verification done in the manifests
and to get around a bug in rspec, which has been fixed
in rodjek/rspec-puppet#107,
certain parameters that should be integer are treated as
strings

files/httpd/keystone.py updated with lastest from keystone git repo

Change-Id: Ide8c090d105c1ea75a14939f5e8ddb7d24ca3f1c
openstack-gerrit pushed a commit to openstack/puppet-keystone that referenced this pull request Dec 3, 2013
Serving keystone from a wsgi container is recommended for production
setups. SSL is enabled by default.

See the following URLs for explanations:
    http://adam.younglogic.com/2012/03/keystone-should-move-to-apache-httpd/
    https://etherpad.openstack.org/havana-keystone-performance

Documentation in manifests/wsgi/apache.pp

Apache can be configured as a drop in replacement for keystone (using
    ports 5000 & 35357) or with paths using the standard SSL port. See
examples in examples/apache_*.pp

- Also change some 'real_' prefix into '_real' suffix to respect the
coding guide.
- Added the '--insecure' option to keystone client in the provider to
allow using self-signed certificates.
- Fixed parsing the ssl/enable value in the provider.

There is no integer verification done in the manifests
and to get around a bug in rspec, which has been fixed
in rodjek/rspec-puppet#107,
certain parameters that should be integer are treated as
strings

files/httpd/keystone.py updated with lastest from keystone git repo

Change-Id: Ide8c090d105c1ea75a14939f5e8ddb7d24ca3f1c
pkasprzak pushed a commit to gwdg/puppet-keystone that referenced this pull request May 9, 2014
Serving keystone from a wsgi container is recommended for production
setups. SSL is enabled by default.

See the following URLs for explanations:
    http://adam.younglogic.com/2012/03/keystone-should-move-to-apache-httpd/
    https://etherpad.openstack.org/havana-keystone-performance

Documentation in manifests/wsgi/apache.pp

Apache can be configured as a drop in replacement for keystone (using
    ports 5000 & 35357) or with paths using the standard SSL port. See
examples in examples/apache_*.pp

- Also change some 'real_' prefix into '_real' suffix to respect the
coding guide.
- Added the '--insecure' option to keystone client in the provider to
allow using self-signed certificates.
- Fixed parsing the ssl/enable value in the provider.

There is no integer verification done in the manifests
and to get around a bug in rspec, which has been fixed
in rodjek/rspec-puppet#107,
certain parameters that should be integer are treated as
strings

files/httpd/keystone.py updated with lastest from keystone git repo

Change-Id: Ide8c090d105c1ea75a14939f5e8ddb7d24ca3f1c

Conflicts:
	examples/apache_dropin.pp
	examples/apache_with_paths.pp
@rodjek rodjek added this to the 1.0.0 milestone Sep 29, 2017
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.

None yet

4 participants