-
-
Notifications
You must be signed in to change notification settings - Fork 247
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
Allow for the macports provider to be overridden on macos #321
Allow for the macports provider to be overridden on macos #321
Conversation
Hmm, so the next issue with this is that the /root/.npmrc file can't be created for npm as that user doesn't exist for macos |
There we go, working when you pass in
if nothing else |
c2ad17a
to
c1b4424
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some tests to cover the change would be super as well, as well as some changes to the README
manifests/init.pp
Outdated
@@ -24,8 +24,20 @@ | |||
$repo_proxy_username = $nodejs::params::repo_proxy_username, | |||
$repo_url_suffix = $nodejs::params::repo_url_suffix, | |||
Array $use_flags = $nodejs::params::use_flags, | |||
$mac_provider = undef, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This isn't the right way to do it. For consistency, the best approach is to create a new variable in params.pp $darwin_package_provider = 'macports'
then do $darwin_package_provider = $nodejs::params::darwin_package_provider
in init.pp
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oooh good point, I was having issues with the provider not overriding when the package statement was in the params as well, but actually that could be moved to init and the default still set in params.
manifests/install.pp
Outdated
@@ -60,9 +60,15 @@ | |||
} | |||
} | |||
|
|||
if $::osfamily == 'Darwin' { | |||
$path = '/var/root' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Given $path
is a banned keyword now I think, consider something like $root_npmrc_path = '/var/root/.npmrc'
instead
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh dear, that's going to cause some fun for me (just starting to move things from puppet 3 to 4 and must have missed this one!)
I wouldn't bother with this for now. |
@kizzie I'm okay with merging minus the travis.yml changes, leaving matching rspec-puppet tests for another Pull Request.
I wouldn't bother with this for now. |
Okey dokey, shall remove the travis bits, as I never did get time to look at it - the rspec ones should at least be easier than trying to force beaker into working forit :) |
manifests/install.pp
Outdated
@@ -60,9 +60,15 @@ | |||
} | |||
} | |||
|
|||
if $::osfamily == 'Darwin' { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please use the new facts hash here:
$facts['os']['family']
manifests/init.pp
Outdated
) inherits nodejs::params { | ||
|
||
if $::osfamily == 'Darwin' { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please use the new facts hash here:
$facts['os']['family']
manifests/init.pp
Outdated
@@ -24,8 +24,13 @@ | |||
$repo_proxy_username = $nodejs::params::repo_proxy_username, | |||
$repo_url_suffix = $nodejs::params::repo_url_suffix, | |||
Array $use_flags = $nodejs::params::use_flags, | |||
$darwin_package_provider = $nodejs::params::darwin_package_provider, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please add a puppet4 datatype for this new parameter
Do you have a preferred way to squash all the commits? Its starting to look a bit of a mess :) (and I'll have to work out what is up with that test when I'm back at work and have more tools with me than just atom and a command prompt - I think changing it from ::osfamily to the new fact style may have caused some interesting times for the tests that don't define it explicitly?) |
1daba1f
to
3b250da
Compare
Can you check the email address used in the first 6 commits? The used email address isn't associated with your github account. |
Oooh work laptop vs home computer. That's awkward. And annoyingly identifiable. Ho hum! |
e40c4b9
to
b853d4a
Compare
So my initial guess was correct, the rspec tests don't like $facts['os']['family'] for anything but ubuntu based systems - it's happy with $facts['osfamily'] though - Not sure whether you want me to go through and work out how to change all the tests to work, or whether to use the older style fact hash? |
$facts['os']['family'] is probably not correctly mocked :(. Using the older $facts['osfamily'] is fine as well. It won't disappear soon. |
b853d4a
to
4e6eb7d
Compare
All fixed up - with some added tests and a bit in the read me :) |
e9ef5ea
to
05cc203
Compare
There we go. Different morning, different realisation that master may have updated. Hopefully all in order now. |
manifests/params.pp
Outdated
@@ -57,6 +57,8 @@ | |||
$npm_path = '/usr/bin/npm' | |||
$repo_class = '::nodejs::repo::nodesource' | |||
} | |||
|
|||
$package_provider = 'apt' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd prefer to set this and others (yum, zypper etc) to undef unless it's non-standard (macports? chocolatey?).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changed it over
manifests/install.pp
Outdated
@@ -18,7 +18,9 @@ | |||
} | |||
} | |||
|
|||
Package { provider => $nodejs::package_provider } | |||
if $nodejs::package_provider != undef { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Technically this is not needed. When undef
it'll fall back on the default value from puppet.
spec/classes/nodejs_spec.rb
Outdated
@@ -18,7 +18,7 @@ | |||
it 'the file resource root_npmrc should be in the catalog' do | |||
is_expected.to contain_file('root_npmrc').with( | |||
'ensure' => 'file', | |||
'path' => '/root/.npmrc', | |||
'path' => '/.npmrc', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is unexpected. We should fix a value for that fact. Could you add it to spec/default_facts.yml
? I'll submit a PR to modulesync_config to ensure it's not overridden.
spec/classes/nodejs_spec.rb
Outdated
it 'the file resource root_npmrc should use /var/root for the path' do | ||
is_expected.to contain_file('root_npmrc').with( | ||
'ensure' => 'file', | ||
'path' => '/.npmrc', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This doesn't match the description. Maybe this should be left out since it's already tested above.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We could either leave it out or override the fact for this test to be closer to the default that Darwin should come up with?
890c9bb
to
b485c6f
Compare
I have no idea why the build is failing to find bundle, any ideas? (it may be that bundler 1.16.1 was released yesterday and isn't quite making it to the build node?) |
.travis.yml
Outdated
@@ -7,6 +7,7 @@ before_install: | |||
- bundle -v | |||
- rm Gemfile.lock || true | |||
- gem update --system | |||
- gem pristine bundler |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Drop this line - after a rebase to master you should have a green build
@@ -12,3 +12,4 @@ concat_basedir: "/tmp" | |||
ipaddress: "172.16.254.254" | |||
is_pe: false | |||
macaddress: "AA:AA:AA:AA:AA:AA" | |||
root_home: /root |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add this to default_module_facts.yaml
as well
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If it's in default_module_facts.yaml
then can't it be removed here? This file is modulesynced while the other isn't.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When I take it out of here then the tests start failing as its not being picked up by from default_module_facts.yaml
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Then I'm not that clear of mind yet. Just leave it in and if it's an issue in the modulesync we'll fix it then.
7a76d31
to
b485c6f
Compare
b485c6f
to
0e57b70
Compare
…dden by the params class
… package providers
… to /var for Darwin
0e57b70
to
bd02e1b
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good, just some minor changes.
@@ -12,3 +12,4 @@ concat_basedir: "/tmp" | |||
ipaddress: "172.16.254.254" | |||
is_pe: false | |||
macaddress: "AA:AA:AA:AA:AA:AA" | |||
root_home: /root |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If it's in default_module_facts.yaml
then can't it be removed here? This file is modulesynced while the other isn't.
manifests/install.pp
Outdated
file { 'root_npmrc': | ||
ensure => 'file', | ||
path => '/root/.npmrc', | ||
path => "${root_npmrc_path}/.npmrc", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can use "${facts['root_home']}/.npmrc"
to remove the additional variable.
@kizzie Thanks for this PR, I have just squashed commits and merged. |
Thanks for addressing all of my many comments @kizzie! |
A vague pondering on how to fix this issue - not sure its 100% working or if my macvm is not happy about npm for other reasons. But any thoughts?