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

Allow package_ensure to be "latest" #62

Merged
merged 1 commit into from
Aug 13, 2020

Conversation

coreone
Copy link
Contributor

@coreone coreone commented Aug 13, 2020

Treat ca_cert::package_ensure: 'latest' the same as the module would present or installed

@pcfens pcfens merged commit 224585b into voxpupuli:master Aug 13, 2020
@pcfens
Copy link
Contributor

pcfens commented Aug 13, 2020

I see you like to live dangerously, but it makes sense that we support it here 😄.

Thanks for the contribution! I'll try to create a new release with this shortly.

@coreone coreone deleted the latest branch August 13, 2020 16:41
@pcfens
Copy link
Contributor

pcfens commented Sep 23, 2020

Sorry for the long delay in getting this in to a release. I just pushed this to the forge in v2.2.0. Thanks again!

@jplana
Copy link

jplana commented Nov 25, 2020

Why should be latest treated the same as present or installed? This completely blocks the ability of the module to manage the package by ignoring the latest case.

A couple of solutions might be:

  if $install_package == true {
    if $package_ensure in ['present', 'installed'] {
      ensure_packages([$package_name])
      Package[$package_name] -> Ca_cert::Ca <| |>
    }
    else {
      package { 'ca-certificates':
        ensure => $package_ensure,
        name   => $package_name,
      }
    }
  }

or

  if $install_package == true {
    if $package_ensure in ['present', 'installed', 'latest'] {
      ensure_packages([$package_name], {'ensure' => $package_ensure})
      Package[$package_name] -> Ca_cert::Ca <| |>
    }
    else {
      package { 'ca-certificates':
        ensure => $package_ensure,
        name   => $package_name,
      }
    }
  }

Either way, the latest ensure should be passed along to the resource or setting latest has the same (unintended) effect as present.

I was tempted to create a new PR, but given that this problem has already been worked on, I was curious if I was missing something.

@coreone
Copy link
Contributor Author

coreone commented Dec 1, 2020

@jplana I agree. I think you're right that the intent of latest is lost here. I created a new PR (#63) to make use of $package_ensure as well as keep the package namevar consistent.

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.

3 participants