On Mon, Mar 16, 2009 at 08:16:31AM -0700, TomTom wrote:
> Second of all, when I try to run the second mysql_B installation,
> puppet borks and says:
> puppetd[23415]: Could not retrieve configuration: Duplicate
> definition: File[/data01/multi_mysql] is already defined in file /etc/
> puppet/manifests/definitions/dba/mysql_instance.pp at line 76; cannot
> redefine at /etc/puppet/manifests/definitions/dba/mysql_instance.pp:76
> 
>  I believe puppet is getting hung up on the "idempotency" (Not sure if
> I am using this word correctly)
> Puppet is seeing the file definition when the function is called to
> install the second instance, and is saying that the definition is

By function I take it you mean "definition".

Puppet only lets you define any resource once.  If you have defined
File['/data_dir/multi_mysql'] once, you can't define it again, no matter
how deeply buried it is within nested classes or definitions.  Don't
panic one way to get around this is checking to see if the resource has
already been defined and only creating it if not.  So change your
mysql_install_definition to have some thing like this:

  if defined( File["/$data_dir/multi_mysql"] ) {
    debug( "/$data_dir/multi_mysql already exists" )
  } else {
    
    file { "/$data_dir/multi_mysql":
             mode    => 775, owner   => "mysql", group   => "sysadmin",
             require => File [ "/$data_dir" ],
         }
  }

Another way to do this would be to have a class that creates the
multi_mysql directory and have this definition include it.  That would
be more idiomatic puppetry, I think, because it sticks with the
convention of using classes for things of which there is only one.

-- 
Bruce

What would Edward Woodward do?

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Puppet Users" group.
To post to this group, send email to puppet-users@googlegroups.com
To unsubscribe from this group, send email to 
puppet-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/puppet-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to