diff --git a/REFERENCE.md b/REFERENCE.md index 7a30e9c31..481f1903c 100644 --- a/REFERENCE.md +++ b/REFERENCE.md @@ -44,14 +44,14 @@ #### Public Resource types -* [`mysql_grant`](#mysql_grant): @summary Manage a MySQL user's rights. +* [`mysql_database`](#mysql_database): Manage a MySQL database. +* [`mysql_grant`](#mysql_grant): Manage a MySQL user's rights. * [`mysql_login_path`](#mysql_login_path): Manage a MySQL login path. * [`mysql_plugin`](#mysql_plugin): Manage MySQL plugins. -* [`mysql_user`](#mysql_user): @summary Manage a MySQL user. This includes management of users password as well as privileges. +* [`mysql_user`](#mysql_user): Manage a MySQL user. This includes management of users password as well as privileges. #### Private Resource types -* `mysql_database`: Manage a MySQL database. * `mysql_datadir`: Manage MySQL datadirs with mysql_install_db OR mysqld (5.7.6 and above). ### Functions @@ -1158,8 +1158,8 @@ The following parameters are available in the `mysql::db` defined type: ##### `name` The name of the database to create. Database names must: - * be longer than 64 characters. - * not contain / \ or . characters. + * not be longer than 64 characters. + * not contain '/' '\' or '.' characters. * not contain characters that are not permitted in file names. * not end with space characters. @@ -1281,9 +1281,58 @@ Default value: `undef` ## Resource types +### `mysql_database` + +Manage a MySQL database. + +#### Properties + +The following properties are available in the `mysql_database` type. + +##### `charset` + +Valid values: `%r{^\S+$}` + +The CHARACTER SET setting for the database + +Default value: `utf8` + +##### `collate` + +Valid values: `%r{^\S+$}` + +The COLLATE setting for the database + +Default value: `utf8_general_ci` + +##### `ensure` + +Valid values: `present`, `absent` + +The basic property that the resource should be in. + +Default value: `present` + +#### Parameters + +The following parameters are available in the `mysql_database` type. + +* [`name`](#-mysql_database--name) +* [`provider`](#-mysql_database--provider) + +##### `name` + +namevar + +The name of the MySQL database to manage. + +##### `provider` + +The specific backend to use for this `mysql_database` resource. You will seldom need to specify this --- Puppet will +usually discover the appropriate provider for your platform. + ### `mysql_grant` -@summary Manage a MySQL user's rights. #### Properties @@ -1483,7 +1532,6 @@ usually discover the appropriate provider for your platform. ### `mysql_user` -@summary Manage a MySQL user. This includes management of users password as well as privileges. #### Properties diff --git a/lib/puppet/type/mysql_database.rb b/lib/puppet/type/mysql_database.rb index 916caf62a..2335a55a5 100644 --- a/lib/puppet/type/mysql_database.rb +++ b/lib/puppet/type/mysql_database.rb @@ -2,10 +2,7 @@ Puppet::Type.newtype(:mysql_database) do @doc = <<-PUPPET - @summary - Manage a MySQL database. - - @api private + @summary Manage a MySQL database. PUPPET ensurable diff --git a/lib/puppet/type/mysql_datadir.rb b/lib/puppet/type/mysql_datadir.rb index f2bfe782d..0dcc8490f 100644 --- a/lib/puppet/type/mysql_datadir.rb +++ b/lib/puppet/type/mysql_datadir.rb @@ -2,8 +2,7 @@ Puppet::Type.newtype(:mysql_datadir) do @doc = <<-PUPPET - @summary - Manage MySQL datadirs with mysql_install_db OR mysqld (5.7.6 and above). + @summary Manage MySQL datadirs with mysql_install_db OR mysqld (5.7.6 and above). @api private PUPPET diff --git a/lib/puppet/type/mysql_grant.rb b/lib/puppet/type/mysql_grant.rb index 92db6d935..34b025cdd 100644 --- a/lib/puppet/type/mysql_grant.rb +++ b/lib/puppet/type/mysql_grant.rb @@ -2,8 +2,7 @@ Puppet::Type.newtype(:mysql_grant) do @doc = <<-PUPPET - @summary - Manage a MySQL user's rights. + @summary Manage a MySQL user's rights. PUPPET ensurable diff --git a/lib/puppet/type/mysql_login_path.rb b/lib/puppet/type/mysql_login_path.rb index 2fea37e03..84c8b06c6 100644 --- a/lib/puppet/type/mysql_login_path.rb +++ b/lib/puppet/type/mysql_login_path.rb @@ -6,8 +6,7 @@ name: 'mysql_login_path', docs: <<-DESCRIPTION, - @summary - Manage a MySQL login path. + @summary Manage a MySQL login path. @see https://dev.mysql.com/doc/refman/8.0/en/mysql-config-editor.html @example diff --git a/lib/puppet/type/mysql_plugin.rb b/lib/puppet/type/mysql_plugin.rb index b52539bbf..cf69fcc60 100644 --- a/lib/puppet/type/mysql_plugin.rb +++ b/lib/puppet/type/mysql_plugin.rb @@ -2,8 +2,7 @@ Puppet::Type.newtype(:mysql_plugin) do @doc = <<-PUPPET - @summary - Manage MySQL plugins. + @summary Manage MySQL plugins. @example mysql_plugin { 'some_plugin': diff --git a/lib/puppet/type/mysql_user.rb b/lib/puppet/type/mysql_user.rb index 6a69478e4..6540823d3 100644 --- a/lib/puppet/type/mysql_user.rb +++ b/lib/puppet/type/mysql_user.rb @@ -3,8 +3,7 @@ # This has to be a separate type to enable collecting Puppet::Type.newtype(:mysql_user) do @doc = <<-PUPPET - @summary - Manage a MySQL user. This includes management of users password as well as privileges. + @summary Manage a MySQL user. This includes management of users password as well as privileges. PUPPET ensurable diff --git a/manifests/db.pp b/manifests/db.pp index 36a298459..98f051c05 100644 --- a/manifests/db.pp +++ b/manifests/db.pp @@ -11,8 +11,8 @@ # # @param name # The name of the database to create. Database names must: -# * be longer than 64 characters. -# * not contain / \ or . characters. +# * not be longer than 64 characters. +# * not contain '/' '\' or '.' characters. # * not contain characters that are not permitted in file names. # * not end with space characters. # @param user @@ -68,8 +68,8 @@ # Ensure that the database name is valid. if $dbname !~ /^[^\/?%*:|\""<>.\s;]{1,64}$/ { $message = "The database name '${dbname}' is invalid. Values must: - * be longer than 64 characters. - * not contain // \\ or . characters. + * not be longer than 64 characters. + * not contain '/' '\\' or '.' characters. * not contain characters that are not permitted in file names. * not end with space characters." fail($message)