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

Enhance distro support #342

Closed
wants to merge 7 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -488,6 +488,16 @@ that were available on 2017-11-14:
* Fedora 25 ```4.x``` ```6.x``` ```7.x``` ```8.x``` ```9.x```
* Fedora 26 ```6.x``` ```8.x``` ```9.x```

#### `repo_release`

Option to override the apt distro release. Defaults to undef which will
autodetect the distro, if specified will influence the apt repo distro.
This is useful if the distro name does not exist in the nodejs repos, for
example a derivative distribution.
eg. Ubilinux 4 distro release name is 'dolcetto' which does not exist in
nodejs repos, but is a derivative of Debian 9 'stretch'. Setting this
param to 'stretch' therefore allows this repo management to work as expected.

#### `use_flags`

The USE flags to use for the Node.js package on Gentoo systems. Defaults to
Expand Down
1 change: 1 addition & 0 deletions manifests/init.pp
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
$repo_proxy_password = $nodejs::params::repo_proxy_password,
$repo_proxy_username = $nodejs::params::repo_proxy_username,
$repo_url_suffix = $nodejs::params::repo_url_suffix,
Optional[String] $repo_release = $nodejs::params::repo_release,
Array $use_flags = $nodejs::params::use_flags,
) inherits nodejs::params {

Expand Down
3 changes: 2 additions & 1 deletion manifests/params.pp
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
$repo_proxy_password = 'absent'
$repo_proxy_username = 'absent'
$repo_url_suffix = '0.10'
$repo_release = undef
Copy link
Member

@juniorsysadmin juniorsysadmin Nov 18, 2017

Choose a reason for hiding this comment

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

It's clearer if you default to $::lsbdistcodename here and remove the pick() later, no?

Copy link
Member

Choose a reason for hiding this comment

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

But that fact is undefined on many OSes so I'm assuming he didn't want to break strict variables. On Debian it is defined so you can safely use it with pick()

Copy link
Contributor Author

Choose a reason for hiding this comment

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

As per voxpupuli/puppet-nginx#1154 (comment), changing to pass $repo_release through unaltered and let apt module deal with undef release.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Added datatype to new parameter, and pass it straight through apt module in commits fdb655d 63c3d3c

$use_flags = ['npm', 'snapshot']

# The full path to cmd.exe is required on Windows. The system32 fact is only
Expand All @@ -25,7 +26,7 @@
if $::operatingsystemrelease =~ /^6\.(\d+)/ {
fail("The ${module_name} module is not supported on Debian Squeeze.")
}
elsif $::operatingsystemrelease =~ /^[78]\.(\d+)/ {
elsif $::operatingsystemrelease =~ /^[789]\.(\d+)/ {
Copy link
Member

Choose a reason for hiding this comment

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

Wouldn't versioncmp($::operatingsystemmajrelease, '7') >= 0 be better and more future proof?

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 think that would incorrectly catch the Ubuntu versions as well wouldn't it?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This will likely break for the next version of Debian (10) as it will start to conflict with Ubuntu 10.x, logic should be broken off separately for Debian and Ubuntu.

Copy link
Member

Choose a reason for hiding this comment

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

You're right. Early morning code reviews aren't the best idea :P

$legacy_debian_symlinks = false
$manage_package_repo = true
$nodejs_debug_package_name = 'nodejs-dbg'
Expand Down
1 change: 1 addition & 0 deletions manifests/repo/nodesource.pp
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
$proxy_password = $nodejs::repo_proxy_password
$proxy_username = $nodejs::repo_proxy_username
$url_suffix = $nodejs::repo_url_suffix
$release = $nodejs::repo_release

case $::osfamily {
'RedHat': {
Expand Down
3 changes: 2 additions & 1 deletion manifests/repo/nodesource/apt.pp
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
$ensure = $nodejs::repo::nodesource::ensure
$pin = $nodejs::repo::nodesource::pin
$url_suffix = $nodejs::repo::nodesource::url_suffix
$release = $nodejs::repo::nodesource::release

ensure_packages(['apt-transport-https', 'ca-certificates'])

Expand All @@ -21,7 +22,7 @@
},
location => "https://deb.nodesource.com/node_${url_suffix}",
pin => $pin,
release => $::lsbdistcodename,
release => $release,
repos => 'main',
require => [
Package['apt-transport-https'],
Expand Down