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

First run on new server fails due to ordering of package and file resources #421

Closed
sagepe opened this issue Sep 3, 2024 · 0 comments · Fixed by #422
Closed

First run on new server fails due to ordering of package and file resources #421

sagepe opened this issue Sep 3, 2024 · 0 comments · Fixed by #422

Comments

@sagepe
Copy link
Contributor

sagepe commented Sep 3, 2024

Affected Puppet, Ruby, OS and module versions/distributions

  • Puppet: 8.8.1
  • Ruby: ruby 3.2.4 (2024-04-23 revision af471c0e01) [x86_64-linux]
  • Distribution: Debian 12
  • Module version: 5.0.1-rc0

How to reproduce (e.g Puppet code you use)

On a new server, use this module to install Icinga Web 2.

For reference, this is the class declaration in our profile:

  class { 'icingaweb2':
    manage_repos           => false,
    db_type                => 'pgsql',
    db_name                => $web_db_name,
    db_username            => $web_db_name,
    db_password            => $web_db_password,
    db_host                => $web_db_host,
    import_schema          => $import_schema,
    default_admin_password => $default_admin_password,
  }

What are you seeing

On a new server instance this module will sometimes try to create file resources before the package the creates the parent directories has been installed.

What behaviour did you expect instead

The module should ensure that the package is installed before trying to create the directory structure that relies on it.

Output log

Info: Applying configuration version 'REDACTED'
Error: Cannot create /etc/icingaweb2/modules; parent directory /etc/icingaweb2 does not exist
Error: /Stage[main]/Icingaweb2::Install/File[/etc/icingaweb2/modules]/ensure: change from 'absent' to 'directory' failed: Cannot create /etc/icingaweb2/modules; parent directory /etc/icingaweb2 does not exist
Error: Cannot create /etc/icingaweb2/enabledModules; parent directory /etc/icingaweb2 does not exist
Error: /Stage[main]/Icingaweb2::Install/File[/etc/icingaweb2/enabledModules]/ensure: change from 'absent' to 'directory' failed: Cannot create /etc/icingaweb2/enabledModules; parent directory /etc/icingaweb2 does not exist
Error: Cannot create /etc/icingaweb2/navigation; parent directory /etc/icingaweb2 does not exist
Error: /Stage[main]/Icingaweb2::Install/File[/etc/icingaweb2/navigation]/ensure: change from 'absent' to 'directory' failed: Cannot create /etc/icingaweb2/navigation; parent directory /etc/icingaweb2 does not exist
Error: Cannot create /etc/icingaweb2/preferences; parent directory /etc/icingaweb2 does not exist
Error: /Stage[main]/Icingaweb2::Install/File[/etc/icingaweb2/preferences]/ensure: change from 'absent' to 'directory' failed: Cannot create /etc/icingaweb2/preferences; parent directory /etc/icingaweb2 does not exist
Error: Cannot create /etc/icingaweb2/dashboards; parent directory /etc/icingaweb2 does not exist
Error: /Stage[main]/Icingaweb2::Install/File[/etc/icingaweb2/dashboards]/ensure: change from 'absent' to 'directory' failed: Cannot create /etc/icingaweb2/dashboards; parent directory /etc/icingaweb2 does not exist
Error: Cannot create /var/lib/icingaweb2/certs; parent directory /var/lib/icingaweb2 does not exist
Error: /Stage[main]/Icingaweb2::Install/File[/var/lib/icingaweb2/certs]/ensure: change from 'absent' to 'directory' failed: Cannot create /var/lib/icingaweb2/certs; parent directory /var/lib/icingaweb2 does not exist
Error: Cannot create /usr/share/icingaweb2/etc; parent directory /usr/share/icingaweb2 does not exist
Error: /Stage[main]/Icingaweb2::Install/File[/usr/share/icingaweb2/etc]/ensure: change from 'absent' to 'directory' failed: Cannot create /usr/share/icingaweb2/etc; parent directory /usr/share/icingaweb2 does not exist
Notice: /Stage[main]/Icingaweb2::Install/Exec[link old db schema directory for compatibility]/returns: ln: failed to create symbolic link '/usr/share/icingaweb2/etc/schema': No such file or directory
Error: 'ln -s /usr/share/icingaweb2/schema /usr/share/icingaweb2/etc/schema' returned 1 instead of one of [0]
Error: /Stage[main]/Icingaweb2::Install/Exec[link old db schema directory for compatibility]/returns: change from 'notrun' to ['0'] failed: 'ln -s /usr/share/icingaweb2/schema /usr/share/icingaweb2/etc/schema' returned 1 instead of one of [0] (corrective)
Notice: /Stage[main]/Icingaweb2::Install/Package[icingaweb2]/ensure: created

Any additional information you'd like to impart

I've got a what I think is fix in our fork, and will send a PR.

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 a pull request may close this issue.

1 participant