From 59c2d25f771c4eee3d97859c7bdeff971a306cba Mon Sep 17 00:00:00 2001 From: Travis Fields Date: Wed, 12 Aug 2015 14:26:40 -0700 Subject: [PATCH 1/4] (docs) MODULES-2402 Add require for sqlserver_tsql - Add description about requirement of sqlserver:;config for sqlserver_tsql provider --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index 583fe4c1..4ec7a759 100644 --- a/README.md +++ b/README.md @@ -248,6 +248,8 @@ For more information about installer switches and configuring SQL Server, see th Executes a TSQL query against a SQL Server instance. +Requires the `sqlserver::config` define for access to the parent instance. + * `command`: *Optional.* Supplies a TSQL statement to execute. Valid options: a string. * `instance`: *Required.* Specifies the SQL Server instance on which to execute the statement. Valid options: a string containing the name of an existing instance. Default: 'MSSQLSERVER'. From f23f32b5cfc1602e8dd2ad832900297c9d9a4941 Mon Sep 17 00:00:00 2001 From: Travis Fields Date: Wed, 12 Aug 2015 14:30:57 -0700 Subject: [PATCH 2/4] (docs) MODULES-2371 log_filename description update - Add better description that the filename should be an absolute path --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 4ec7a759..2de5ed9a 100644 --- a/README.md +++ b/README.md @@ -308,7 +308,7 @@ Requires the `sqlserver::config` define for access to the parent instance. * `log_filegrowth`: *Optional.* Specifies the automatic growth increment of the log file. Cannot be specified if `os_file_name` is set to a UNC path. Does not apply to a FILESTREAM filegroup. This parameter is set at creation only; it is not affected by updates. Valid options: a number with an optional suffix of 'KB', 'MB', 'GB', or 'TB', no greater than the value of `log_maxsize`. If you do not include a suffix, SQL Server assumes the number is in megabytes. Default: undef. -* `log_filename`: *Required if `log_name` is specified.* Specifies the operating system (physical) name of the log file. This parameter is set at creation only; it is not affected by updates. Valid options: a string. Default: undef. +* `log_filename`: *Required if `log_name` is specified.* Specifies the operating system (physical) name of the log file. This parameter is set at creation only; it is not affected by updates. Valid options: a string containing an absolute path. Default: undef. * `log_maxsize`: *Optional.* Specifies the maximum size to which the log file can grow. Cannot be specified if `os_file_name` is set to a UNC path. This parameter is set at creation only; it is not affected by updates. Valid options: a number, no greater than 2147483647, with an optional suffix of 'KB', 'MB', 'GB', or 'TB'. If you do not include a suffix, SQL Server assumes the number is in megabytes. Default: undef. From 318a74bc62289c9a1959bce8242bef8661c062bf Mon Sep 17 00:00:00 2001 From: Travis Fields Date: Wed, 12 Aug 2015 14:34:46 -0700 Subject: [PATCH 3/4] (docs) Add database param descriptions for sqlserver_tsql - Add desc block to type - Add parameter to README --- README.md | 4 +++- lib/puppet/type/sqlserver_tsql.rb | 1 + 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 2de5ed9a..622e6104 100644 --- a/README.md +++ b/README.md @@ -252,7 +252,9 @@ Requires the `sqlserver::config` define for access to the parent instance. * `command`: *Optional.* Supplies a TSQL statement to execute. Valid options: a string. -* `instance`: *Required.* Specifies the SQL Server instance on which to execute the statement. Valid options: a string containing the name of an existing instance. Default: 'MSSQLSERVER'. +* `instance`: *Required.* Specifies the SQL Server instance on which to execute the statement. Valid options: a string containing the name of an existing instance. Default: 'MSSQLSERVER'. + +* `database`: *Optional* Specifies the default database to connect to. Default: 'master' * `onlyif`: *Optional.* Supplies a TSQL statement to execute before running the `command` statement, determining whether to move forward. If the `onlyif` statement ends with a THROW or any non-standard exit, Puppet executes the `command` statement. Valid options: a string. diff --git a/lib/puppet/type/sqlserver_tsql.rb b/lib/puppet/type/sqlserver_tsql.rb index 244435e3..c13d5e5f 100644 --- a/lib/puppet/type/sqlserver_tsql.rb +++ b/lib/puppet/type/sqlserver_tsql.rb @@ -29,6 +29,7 @@ def self.checks end newparam(:database) do + desc 'initial database to connect to during query execution' defaultto 'master' validate do |value| fail("Invalid database name #{value}") unless /^[[:word:]|#|@]+/.match(value) From c1debc376e723ddc1bc361866a626900903d3798 Mon Sep 17 00:00:00 2001 From: Travis Fields Date: Thu, 13 Aug 2015 09:44:59 -0700 Subject: [PATCH 4/4] (docs) Fix desc call inside the newparam blocks - desc blocks were being called outside the newparam block and need to move inside --- lib/puppet/type/sqlserver_tsql.rb | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/puppet/type/sqlserver_tsql.rb b/lib/puppet/type/sqlserver_tsql.rb index c13d5e5f..fe648841 100644 --- a/lib/puppet/type/sqlserver_tsql.rb +++ b/lib/puppet/type/sqlserver_tsql.rb @@ -16,13 +16,13 @@ def self.checks @checks.keys end - desc 'command to run against an instance with the authenticated credentials used in sqlserver::config' newparam(:command, :parent => Puppet::Property::SqlserverTsql) do + desc 'command to run against an instance with the authenticated credentials used in sqlserver::config' end - desc 'requires the usage of sqlserver::config with the user and password' newparam(:instance) do + desc 'requires the usage of sqlserver::config with the user and password' munge do |value| value.upcase end @@ -36,8 +36,8 @@ def self.checks end end - desc 'SQL Query to run and only run if exits with non-zero' newcheck(:onlyif, :parent => Puppet::Property::SqlserverTsql) do + desc 'SQL Query to run and only run if exits with non-zero' #Runs in the event that our TSQL exits with anything other than 0 def check(value) output = provider.run(value)