I am looking to extend one of the puppet modules -"mysql". I found that they 
are extending Puppet with types and providers. First off I am having a 
difficult time find any documentationo on this and I do not know Ruby that 
well. The problem that I am having is this, I have the following code:

Puppet::Type.type(:database).provide(:mysql) do
desc "Manages MySQL database."

  defaultfor :kernel => 'Linux'

  optional_commands :mysql      => 'mysql'

def create
    def create
    mysql("-u #{resource[:rootuser]} -p\'#{resource[:rootpassword]}\' -h 
#{resource[:host]} -NBev", "create database #{@resource[:name]} character set 
#{resource[:charset]}")
  end

It fails with the following error, if I run the command on the command line it 
runs successfully but in Puppet it fails. Can someone help me understand how 
the mysql is being executed with mysql?

debug: Puppet::Type::Database::ProviderMysql: Executing '/usr/bin/mysql -u 
admin -p'password' -h vm-minux.comm.com -NBev create database mydb character 
set utf8'
err: 
/Stage[main]//Node[ssat-puppetagent-1.qcomm.com]/Test_mod::Db[mydb]/Database[mydb]/ensure:
 change from absent to present failed: 
Execution of '/usr/bin/mysql -u admin -p'password' -h vm-mlinux.qcomm.com -NBev 
create database mydb character set utf8' returned 1: ERROR 1044 (42000): Access 
denied for user ''@'localhost' to database 'create database mydb character set 
utf8'

PE
2.5.1

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Users" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/puppet-users/-/gPqNsft3rAYJ.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/puppet-users?hl=en.

Reply via email to