Skip to content
This repository was archived by the owner on Jun 11, 2019. It is now read-only.

Error: Duplicate declaration: grant.pp:115 #63

Open
ghost opened this issue Jul 15, 2015 · 1 comment
Open

Error: Duplicate declaration: grant.pp:115 #63

ghost opened this issue Jul 15, 2015 · 1 comment

Comments

@ghost
Copy link

ghost commented Jul 15, 2015

Hi,

I am trying to run the same puppet apply on the same instance and gets this issue second time round, could this resource not be more unique?

Error: Duplicate declaration: File[mysqlgrant-ejbca-localhost-MSMCA.sql] is already declared in file /etc/puppet/modules/mysql/manifests/grant.pp:115; cannot redeclare at /etc/puppet/modules/mysql/manifests/grant.pp:115 on node ip-10-96-3-143.inf1.gb.msm.internal
@ghost
Copy link
Author

ghost commented Jul 15, 2015

I am wondering if it would be better to use the 'title' instead of dbname here;

https://github.com/example42/puppet-mysql/blob/master/manifests/grant.pp#L77

I am trying todo something like this:

  if exists($backup_file_guard_with_fqdn) {
    mysql::query { $supported_ejbca_dbname:
      mysql_query    => "DROP DATABASE IF EXISTS ${supported_ejbca_dbname};",
      mysql_user     => $supported_ejbca_username,
      mysql_password => $supported_ejbca_password,
      require        => Class['mysql'],
      before         => Service['jboss']
    } ->
    mysql::grant { "revoke-${supported_ejbca_dbname}":
      ensure         => 'absent',
      mysql_db       => $supported_ejbca_dbname,
      mysql_user     => $supported_ejbca_username,
      mysql_password => $supported_ejbca_password,
      require        => Class['mysql'],
      before         => Service['jboss']
    } ->
    mysql::grant { "create-${supported_ejbca_dbname}":
      ensure                   => 'present',
      mysql_db                 => $supported_ejbca_dbname,
      mysql_user               => $supported_ejbca_username,
      mysql_password           => $supported_ejbca_password,
      mysql_db_init_query_file => $backup_file_name_with_fqdn,
      require                  => Class['mysql'],
      before                   => Service['jboss']
    }
  } else {
    mysql::grant { "create-${supported_ejbca_dbname}":
      ensure         => 'present',
      mysql_db       => $supported_ejbca_dbname,
      mysql_user     => $supported_ejbca_username,
      mysql_password => $supported_ejbca_password,
      require        => Class['mysql'],
      before         => Service['jboss']
    }
  }

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

No branches or pull requests

0 participants