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

Unable to contain apt::update #1059

Open
olavmo-sikt opened this issue Sep 13, 2022 · 1 comment
Open

Unable to contain apt::update #1059

olavmo-sikt opened this issue Sep 13, 2022 · 1 comment

Comments

@olavmo-sikt
Copy link

Use Case

I want a class that configures an APT repository to also ensure that apt-get update has run before any dependencies on that class.
This way I can depend on the class that configures the repository without needing to know how this repository is configured.
E.g.:

class mymod::repository {
  if $facts['os']['family'] == 'Debian' {
    apt::source { 'somerepo':
      ...
    }
    contain apt::update
  } else {...}
}

class mymod {
  require mymod::repository # Make sure that the repository is configured and available.
  package { 'somepackage':
    ensure => 'present',
  }
}

This is currently not possible by using contain apt::source because that class is private.
Instead if fails with:

error during compilation: Evaluation Error: Error while evaluating a Function Call, Class apt::update is private

Describe the Solution You Would Like

Since the apt::update class is a documented part of this module, I think it could be marked as public.
That would allow it to be used both through contain and through direct dependencies (require => Class['apt::update']).

Describe Alternatives You've Considered

Two alternatives:

  1. Using an anchor: `Class['apt::update'] -> anchor { 'mymod::repository::last' }'. The downside of this is that anchors are deprecated and no longer documented as part of containment.
  2. Directly depending on `Class['apt::update'] in the package resource. This only works if the repository configured is always an APT repository
@github-actions
Copy link

Hello! 👋

This issue has been open for a while and has had no recent activity. We've labelled it with attention-needed so that we can get a clear view of which issues need our attention.

If you are waiting on a response from us we will try and address your comments on a future Community Day.

Alternatively, if it is no longer relevant to you please close the issue with a comment.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants