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

Error when installing puppet-agent on Ubuntu #166

Open
hrpatel opened this issue Aug 15, 2017 · 5 comments
Open

Error when installing puppet-agent on Ubuntu #166

hrpatel opened this issue Aug 15, 2017 · 5 comments

Comments

@hrpatel
Copy link
Contributor

hrpatel commented Aug 15, 2017

apt-get update is not running before the module tries to install puppet-agent

...
((setup apt source))
Debug: Prefetching apt_key resources for apt_key
Debug: Executing '/usr/bin/apt-key adv --list-keys --with-colons --fingerprint --fixed-list-mode'
Notice: /Stage[main]/Puppet::Repo::Apt/Apt::Source[puppetlabs-pc1]/Apt::Setting[list-puppetlabs-pc1]/File[/etc/apt/sources.list.d/puppetlabs-pc1.list]/ensure: created
Debug: /Stage[main]/Puppet::Repo::Apt/Apt::Source[puppetlabs-pc1]/Apt::Setting[list-puppetlabs-pc1]/File[/etc/apt/sources.list.d/puppetlabs-pc1.list]: The container Apt::Setting[list-puppetlabs-pc1] will propagate my refresh event
Info: /Stage[main]/Puppet::Repo::Apt/Apt::Source[puppetlabs-pc1]/Apt::Setting[list-puppetlabs-pc1]/File[/etc/apt/sources.list.d/puppetlabs-pc1.list]: Scheduling refresh of Class[Apt::Update]
Debug: Apt::Setting[list-puppetlabs-pc1]: The container Apt::Source[puppetlabs-pc1] will propagate my refresh event
Debug: Apt::Source[puppetlabs-pc1]: The container Class[Puppet::Repo::Apt] will propagate my refresh event
((Try to install puppet-agent))
Debug: Executing '/usr/bin/dpkg-query -W --showformat '${Status} ${Package} ${Version}\n' puppet-agent'
Debug: Executing '/usr/bin/apt-get -q -y -o DPkg::Options::=--force-confold install puppet-agent'
Error: Execution of '/usr/bin/apt-get -q -y -o DPkg::Options::=--force-confold install puppet-agent' returned 100: Reading package lists...
Building dependency tree...
Reading state information...
Package puppet-agent is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or
is only available from another source...
...
((eventually run an apt-get update))
Info: Class[Apt::Update]: Scheduling refresh of Exec[apt_update]
Debug: Exec[apt_update](provider=posix): Executing '/usr/bin/apt-get update'
Debug: Executing '/usr/bin/apt-get update'
Notice: /Stage[main]/Apt::Update/Exec[apt_update]: Triggered 'refresh' from 1 events
Debug: /Stage[main]/Apt::Update/Exec[apt_update]: The container Class[Apt::Update] will propagate my refresh event
Debug: Class[Apt::Update]: The container Stage[main] will propagate my refresh event

I checked the apt module documentation examples, nothing stood out .

@rendhalver
Copy link
Member

This kind of issue is best solved in your local profiles and roles.
Doing apt updates at the module level is likely to cause resource duplication.

We do something like this in our base profile.

Class['profile::for::managing::apt'] ~> Class['apt::update'] -> Package<| |>

@hrpatel
Copy link
Contributor Author

hrpatel commented Aug 15, 2017

Hmmm... I don't have a profile to manage apt, this error happens when I try to upgrade puppet to v4 as follows:

    # upgrade to puppet v4
    class { '::puppet::profile::agent':
      agent_version             => 'latest',
      allinone                  => true,
      collection                => 'PC1',
      enabled                   => false,
      manage_etc_facter         => false,
      manage_etc_facter_facts_d => false,
      reports                   => false,
      show_diff                 => true,
    }

What about something like this in .../repo/apt.pp?

...
    include ::apt
    Class['apt::update'] -> Package<| |>
...

In the meantime, I'll dig into our profiles and see if a better place makes sense for that relationship since its technically applicable for all packages and not just puppet-agent

@hrpatel
Copy link
Contributor Author

hrpatel commented Aug 15, 2017

I was able to add these lines to a profile class and got it working

      # Ensure packages are installed after `apt-get update` is run
      Class['apt::update'] -> Package<| |>

I think we should still consider adding the lines above to apt.pp so the module works on its own.

@rendhalver
Copy link
Member

Like i mentioned in my first comment that sort of thing is best done at the organisation level not the module level.

@hrpatel
Copy link
Contributor Author

hrpatel commented Aug 17, 2017

@rendhalver whats the concern with defining that relationship? It wont duplicate resources and it makes the module more robust.

If the concern is affecting other modules then what about this?

  Class['Apt::Update'] -> Package<|tag == 'puppet'|>

on the package resources:

          package { "puppetlabs-release-${lc_collection_name}":
            ensure => latest,
            tag    => 'puppet',
          }

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

No branches or pull requests

2 participants