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

Add smart_proxy_chef plugin support #152

Merged
merged 1 commit into from Feb 23, 2015

Conversation

ares
Copy link
Member

@ares ares commented Feb 17, 2015

No description provided.

@ares
Copy link
Member Author

ares commented Feb 17, 2015

Replaces #150, fixed the last @ekohl's review

@ekohl
Copy link
Member

ekohl commented Feb 17, 2015

👍

@domcleal
Copy link
Contributor

Plugin classes recently gained "version" and "listen_on" parameters as standard, could you add these too please?

@ares
Copy link
Member Author

ares commented Feb 17, 2015

oh, right, I'll add it

@ekohl
Copy link
Member

ekohl commented Feb 17, 2015

@domcleal we should document 'writing a plugin' in the README.

@ares
Copy link
Member Author

ares commented Feb 17, 2015

That wouldn't help in this case, I wrote this a long time before I submitted final version with just small changes. I think most people would look to existing plugin in the beginning. Maybe some puppet-lint rule to check whether plugin classes have required parameters would work.

@ekohl
Copy link
Member

ekohl commented Feb 17, 2015

@ares true, but it could help me since I forgot that we wanted to add those. A puppet-lint rule could help but for now manual reviews are the only thing we have.

@ares
Copy link
Member Author

ares commented Feb 17, 2015

@domcleal updated

$ssl_pem_file = $::foreman_proxy::plugin::chef::params::ssl_pem_file,
) inherits foreman_proxy::plugin::chef::params {

foreman_proxy::plugin {'chef': } ->
Copy link
Member

Choose a reason for hiding this comment

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

You still need to pass on $version here.

@ares
Copy link
Member Author

ares commented Feb 18, 2015

@ekohl thanks, I also added validations, could you give it another look please?

foreman_proxy::plugin {'chef':
version => $version,
} ->
foreman_proxy::settings_fule { 'chef':
Copy link
Contributor

Choose a reason for hiding this comment

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

file!

@domcleal
Copy link
Contributor

I think your tests didn't run, as the filename ends in ".spec" rather than "_spec".

@ares
Copy link
Member Author

ares commented Feb 18, 2015

Now found found my trick to mask typos :-) Thanks @domcleal very much indeed. Once I get ACK from both of you I'd like to test it end to end again because there were so many changes. After that I can confirm it works and can be merged.

@domcleal
Copy link
Contributor

It's very red :)

foreman_proxy::plugin {'chef':
version => $version,
} ->
foreman_proxy::settings_file { 'chef':
Copy link
Member

Choose a reason for hiding this comment

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

This loads templates/chef.yml.erb while the file is called templates/plugin/chef.yml.erb which leads to red tests.

Copy link
Member

Choose a reason for hiding this comment

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

Most plugins override it with template_path so I think that would be best here as well.

@ares ares force-pushed the smartproxy_chef_plugin branch 2 times, most recently from ef2f91a to ee44bf9 Compare February 19, 2015 07:32

it 'should install configuration file' do
should contain_foreman_proxy__settings_file('chef')
content = subject.resource('file', '/etc/foreman-proxy/settings.d/chef.yml').send(:parameters)[:content]
Copy link
Contributor

Choose a reason for hiding this comment

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

s/subject/catalogue/ and ditto below

@ares ares force-pushed the smartproxy_chef_plugin branch 3 times, most recently from 9972943 to 8ba137c Compare February 19, 2015 18:20
@ares
Copy link
Member Author

ares commented Feb 19, 2015

I made it green again. Also added one helper which is in my opinion better way to test the config file.

@mmoll
Copy link
Contributor

mmoll commented Feb 19, 2015

👍


it 'should install configuration file' do
should contain_foreman_proxy__settings_file('chef')
verify_included_content(catalogue, '/etc/foreman-proxy/settings.d/chef.yml', ':enabled: true')
Copy link
Member

Choose a reason for hiding this comment

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

There's already should contain_file('/etc/foreman-proxy/settings.d/chef.yml').with_content(':enabled: true') for this.

@ekohl
Copy link
Member

ekohl commented Feb 19, 2015

Not sure if the extra helper adds that much. Can you explain how it differs from .with_content?

@ares ares force-pushed the smartproxy_chef_plugin branch 2 times, most recently from 19feb90 to 8ba137c Compare February 22, 2015 18:42
@ares
Copy link
Member Author

ares commented Feb 22, 2015

@ekohl the with_content checks the whole file content, including comments etc., I don't want to test all options and comments and depend on their order as it's very fragile, I just want to make sure that there's a line that says :enabled: true

@ekohl
Copy link
Member

ekohl commented Feb 23, 2015

@ares afaik with_content also accepts a regex: with_content(/:enabled: true/) which does what you want.

@ares
Copy link
Member Author

ares commented Feb 23, 2015

@ekohl good, I didn't know this, I changed it to use with_content and I left only get_content helper which may be useful later

@domcleal domcleal merged commit fa087a3 into theforeman:master Feb 23, 2015
@domcleal
Copy link
Contributor

Thanks @ares! Don't forget to send a PR to foreman-installer to add it to the kafo/answer files.

@ares ares deleted the smartproxy_chef_plugin branch February 23, 2015 16:42
ehelms pushed a commit to ehelms/puppet-foreman_proxy that referenced this pull request Aug 25, 2017
Initial setup/use of jenkins-job-builder
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