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

ido schema import dependency #237

Closed
snahelou opened this issue Feb 24, 2017 · 1 comment
Closed

ido schema import dependency #237

snahelou opened this issue Feb 24, 2017 · 1 comment
Assignees
Labels
Milestone

Comments

@snahelou
Copy link

Hello guys,

I tested your module in my dev env and I think you have some bugs with your icinga2::feature::idopgsql

First is a missing dependent when import schema is false.

  if $ido_pgsql_package {
    package { $ido_pgsql_package:
      ensure => installed,
      before => [
        Exec['idopgsql-import-schema'],
        Icinga2::Feature['ido-pgsql'],
      ]
    }
  }

  if $import_schema {
    exec { 'idopgsql-import-schema':
      user        => 'root',
      path        => $::path,
      environment => ["PGPASSWORD=${password}"],
      command     => "psql -h '${host}' -U '${user}' -d '${database}' -w -f /usr/share/icinga2-ido-pgsql/schema/pgsql.sql",
      unless      => "psql -h '${host}' -U '${user}' -d '${database}' -w -c 'select version from icinga_dbversion'",
    }
  }

You will have

Error: Failed to apply catalog: Could not find dependent Exec[idopgsql-import-schema] for Package[icinga2-ido-pgsql] at /etc/puppet/environments/production/modules/icinga2/manifests/feature/idopgsql.pp:113

Second is with your import schema exec command which not support a custom port

  if $import_schema {
    exec { 'idopgsql-import-schema':
      user        => 'root',
      path        => $::path,
      environment => ["PGPASSWORD=${password}"],
      command     => "psql -h '${host}' -U '${user}' -d '${database}' -w -f /usr/share/icinga2-ido-pgsql/schema/pgsql.sql",
      unless      => "psql -h '${host}' -U '${user}' -d '${database}' -w -c 'select version from icinga_dbversion'",
    }
  }
Notice: /Stage[main]/Icinga2::Feature::Idopgsql/Exec[idopgsql-import-schema]/returns: psql: could not connect to server: Connection refused
Notice: /Stage[main]/Icinga2::Feature::Idopgsql/Exec[idopgsql-import-schema]/returns: 	Is the server running on host "127.0.0.1" and accepting
Notice: /Stage[main]/Icinga2::Feature::Idopgsql/Exec[idopgsql-import-schema]/returns: 	TCP/IP connections on port 5432?
Error: psql -h '127.0.0.1' -U 'icinga2' -d 'icinga2' -w -f /usr/share/icinga2-ido-pgsql/schema/pgsql.sql returned 2 instead of one of [0]
Error: /Stage[main]/Icinga2::Feature::Idopgsql/Exec[idopgsql-import-schema]/returns: change from notrun to 0 failed: psql -h '127.0.0.1' -U 'icinga2' -d 'icinga2' -w -f /usr/share/icinga2-ido-pgsql/schema/pgsql.sql returned 2 instead of one of [0]

Hope it can help you

Regards

@lbetz
Copy link
Contributor

lbetz commented Feb 24, 2017

Yes, you're right. The dependency points to /dev/null if the schema is'nt manmaged. The same problem for mysql.

@lbetz lbetz self-assigned this Feb 24, 2017
@lbetz lbetz added the bug label Feb 24, 2017
@lbetz lbetz changed the title ido-pgsql problems ? ido schema import dependency Feb 24, 2017
@lbetz lbetz closed this as completed in 7c800ae Feb 24, 2017
@bobapple bobapple added this to the v1.1.1 milestone Feb 28, 2017
@bobapple bobapple modified the milestones: v1.1.1, v1.2.0 Mar 13, 2017
n00by pushed a commit to n00by/puppet-icinga2 that referenced this issue Apr 26, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants