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

Remove dependency on puppet-common #197

Merged
merged 1 commit into from
May 11, 2018

Conversation

jturel
Copy link
Contributor

@jturel jturel commented May 9, 2018

there wasn't a dependency on puppet-common in the manifest. that seems unexpected!

Copy link
Member

@ekohl ekohl left a comment

Choose a reason for hiding this comment

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

Neat! This has been on my mental todo list.

@@ -0,0 +1,15 @@
module Puppet::Parser::Functions
Copy link
Member

Choose a reason for hiding this comment

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

I think we can get rid of this since we have puppet data types. It means changing Optional[String] $certs_tar to String[1] $certs_tar. The fqdn check should already be redundant. It also means we can remove the if $certs_tar since that looks like a useless check.

Copy link
Contributor Author

@jturel jturel May 9, 2018

Choose a reason for hiding this comment

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

I see. Will give it a try

Copy link
Member

Choose a reason for hiding this comment

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

I mean the whole function can be removed since we can simply replace all function calls with Puppet 4 data types.

context 'with empty certs_tar' do
let(:params) { { certs_tar: '' , foreman_proxy_fqdn: 'example.com' } }

it { should_not compile.with_all_deps }
Copy link
Member

Choose a reason for hiding this comment

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

I think you can leave off the .with_all_deps. Otherwise it could compile with with a missing dependency hiding a real failure. Same with the lower text.

it { should_not compile.with_all_deps }
end

context 'missing foreman_proxy_fqdn' do
Copy link
Member

Choose a reason for hiding this comment

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

I think this is redundant since we default to $::fqdn so you actually need to put in an effort to break this I think. We should change the datatype from Optional[String] $parent_fqdn to String[1] $parent_fqdn as well I think.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

makes sense!

Copy link
Member

@ekohl ekohl left a comment

Choose a reason for hiding this comment

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

Looks good.

@@ -15,4 +15,10 @@
describe 'with default parameters' do
it { should compile.with_all_deps }
end

context 'with empty certs_tar' do
let(:params) { { certs_tar: '' , foreman_proxy_fqdn: 'example.com' } }
Copy link
Member

Choose a reason for hiding this comment

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

We can probably leave out the fqdn parameter (and in the basic test too).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Looks like basic tests needs the default fqdn for one scenario:

    Failure/Error: it { should compile.with_all_deps }
       error during compilation: Evaluation Error: Error while evaluating a Function Call, The hostname is the same as the provided hostname for the foreman-proxy at /home/travis/build/theforeman/puppet-certs/spec/fixtures/modules/certs/manifests/foreman_proxy_content.pp:22:5 on node travis-job-theforeman-puppet-certs-377315866.travisci.net
certs::qpid_client
  on centos-7-x86_64
    without parameters
    should compile into a catalogue without dependency cycles (FAILED - 1)

Copy link
Member

Choose a reason for hiding this comment

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

Ah right :)

require 'spec_helper'
require 'puppetlabs_spec_helper/puppetlabs_spec/puppet_internals'

describe 'validate_file_exists' do
Copy link
Member

Choose a reason for hiding this comment

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

This can probably use a test and verify that / does exist.

@jturel jturel force-pushed the move_common_funcs branch from f8782b1 to ae88afe Compare May 10, 2018 16:19
Copy link
Member

@stbenjam stbenjam left a comment

Choose a reason for hiding this comment

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

LGTM, thanks @jturel!

@stbenjam
Copy link
Member

@jturel Can you also remove puppet-common from https://github.com/Katello/katello-installer/blob/master/Puppetfile#L6?

@jturel
Copy link
Contributor Author

jturel commented May 11, 2018

@jturel Can you also remove puppet-common from https://github.com/Katello/katello-installer/blob/master/Puppetfile#L6?

ah ok! I was missing where the dependency was actually included

@ekohl ekohl merged commit b8367b1 into theforeman:master May 11, 2018
@ekohl
Copy link
Member

ekohl commented May 11, 2018

Thanks!

@jturel jturel deleted the move_common_funcs branch May 11, 2018 15:12
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.

4 participants