From 7496d27645246481b6b00d0323e656cddee52c57 Mon Sep 17 00:00:00 2001 From: Glenn Sarti Date: Mon, 19 Jun 2017 10:16:43 -0700 Subject: [PATCH 1/3] (FM-5389) Fix sql_features when installing SNAC_SDK Previously the sql_features was not idempotent when installing the SQL Native Client SDK (SNAC_SDK). This Due to the SQL Native Client not being unique across SQL Server versions (e.g. SQL 2016 (v13) installs Native Client with a version that matches for SQL 2012 (v11)). Due to MODULES-5060 it is noted that the SQL Server Module can not be used to manage different SQL Server versions on the same host. Knowing this it is safe to collate all of the SQL Server shared features, regardless of version, and use that as the list of installed features and is safely idempotent. This commit also adds a README section to known issues about this issue. --- README.md | 2 ++ .../provider/sqlserver_features/mssql.rb | 23 +++++++++++-------- 2 files changed, 15 insertions(+), 10 deletions(-) diff --git a/README.md b/README.md index 2f34c1b9..55bd52af 100644 --- a/README.md +++ b/README.md @@ -980,6 +980,8 @@ Terminology differs somewhat between various database systems; please refer to t This module is available only for Windows Server 2012 or 2012 R2, and works with Puppet Enterprise 3.7 and later. +This module can only manage a single SQL Server version on a host (one and only one of SQL Server 2012, 2014 or 2016). The module is able to manage multiple SQL Server instances of the same version. + ## Development This module was built by Puppet specifically for use with Puppet Enterprise (PE). diff --git a/lib/puppet/provider/sqlserver_features/mssql.rb b/lib/puppet/provider/sqlserver_features/mssql.rb index 41114dbe..45acb5fc 100644 --- a/lib/puppet/provider/sqlserver_features/mssql.rb +++ b/lib/puppet/provider/sqlserver_features/mssql.rb @@ -13,22 +13,25 @@ def self.instances result = Facter.value(:sqlserver_features) debug "Parsing result #{result}" + # Due to MODULES-5060 we can only output one feature set. If we output + # multiple then it is not possible to install or uninstall due to multiple + # resources with the same name. Also due to the SQL Native Client not + # being unique across SQL Server versions (e.g. SQL 2016 installs Native Client + # with a version that matches for SQL 2012) the features need to be collated + # across all versions and then aggregated into a single resource + featurelist = [] ALL_SQL_VERSIONS.each do |sql_version| next if result[sql_version].empty? + featurelist += result[sql_version] + end + + unless featurelist.count.zero? instance_props = {:name => "Generic Features", :ensure => :present, - :features => result[sql_version].sort + :features => featurelist.uniq.sort } debug "Parsed features = #{instance_props[:features]}" - - instance = new(instance_props) - debug "Created instance #{instance}" - instances << instance - - # Due to MODULES-5060 we can only output one feature set. If we output - # multiple then it is not possible to install or uninstall due to multiple - # resources with the same name. - break + instances = [new(instance_props)] end instances From 77c8e6d96b50bd7bb1bb135a9dfc1c312adf735d Mon Sep 17 00:00:00 2001 From: Glenn Sarti Date: Tue, 20 Jun 2017 10:45:37 -0700 Subject: [PATCH 2/3] Revert "(FM-5389) Add missing shared feature SNAC_SDK" This reverts commit d26c1dfb4f7a1d237838eab34892b2b70ab2429b. --- README.md | 2 +- lib/puppet/type/sqlserver_features.rb | 2 +- lib/puppet_x/sqlserver/features.rb | 1 - 3 files changed, 2 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 55bd52af..8590c3f0 100644 --- a/README.md +++ b/README.md @@ -197,7 +197,7 @@ Default: 'present'. *Required.* -Specifies one or more features to manage. Valid options: 'BC', 'Conn', 'SSMS', 'ADV_SSMS', 'SDK', 'IS', 'MDS', 'BOL', 'DREPLAY_CTLR', 'DREPLAY_CLT', 'SNAC_SDK'. +Specifies one or more features to manage. Valid options: 'BC', 'Conn', 'SSMS', 'ADV_SSMS', 'SDK', 'IS', 'MDS', 'BOL', 'DREPLAY_CTLR', 'DREPLAY_CLT'. The 'Tools' feature is deprecated. Instead specify 'BC', 'SSMS', 'ADV_SSMS', 'Conn', and 'SDK' explicitly. diff --git a/lib/puppet/type/sqlserver_features.rb b/lib/puppet/type/sqlserver_features.rb index 47f61174..166b295e 100644 --- a/lib/puppet/type/sqlserver_features.rb +++ b/lib/puppet/type/sqlserver_features.rb @@ -37,7 +37,7 @@ newproperty(:features, :array_matching => :all) do desc 'Specifies features to install, uninstall, or upgrade. The list of top-level features include BC, Conn, SSMS, ADV_SSMS, SDK, IS and MDS.' - newvalues(:Tools, :BC, :Conn, :SSMS, :ADV_SSMS, :SDK, :IS, :MDS, :BOL, :DREPLAY_CTLR, :DREPLAY_CLT, :SNAC_SDK) + newvalues(:Tools, :BC, :Conn, :SSMS, :ADV_SSMS, :SDK, :IS, :MDS, :BOL, :DREPLAY_CTLR, :DREPLAY_CLT) munge do |value| if PuppetX::Sqlserver::ServerHelper.is_super_feature(value) Puppet.deprecation_warning("Using #{value} is deprecated for features in sql_features resources") diff --git a/lib/puppet_x/sqlserver/features.rb b/lib/puppet_x/sqlserver/features.rb index d60fe026..17921226 100644 --- a/lib/puppet_x/sqlserver/features.rb +++ b/lib/puppet_x/sqlserver/features.rb @@ -174,7 +174,6 @@ def self.get_shared_features(version) 'SQL_DReplay_Controller' => 'DREPLAY_CTLR', # Distributed Replay Controller 'SQL_DReplay_Client' => 'DREPLAY_CLT', # Distributed Replay Client 'sql_shared_mr' => 'SQL_SHARED_MR', # R Server (Standalone) - 'SQL_SNAC_SDK' => 'SNAC_SDK', # SQL Client Connectivity SDK # also WMI: SqlService WHERE SQLServiceType = 4 # MsDtsServer 'SQL_DTS_Full' => 'IS', # Integration Services From d9eec986293f10ebdda3c13484e6f2af55ac50be Mon Sep 17 00:00:00 2001 From: Glenn Sarti Date: Tue, 20 Jun 2017 10:49:38 -0700 Subject: [PATCH 3/3] (FM-5389) Add README about the SNAC_SDK feature The SNAC_SDK feature can not be managed by the module as it is not able to be uninstalled using the SQL Server installation media (particularly on SQL Server 2016). This commit adds a note about this limitation in the README. --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index 8590c3f0..06c6381c 100644 --- a/README.md +++ b/README.md @@ -982,6 +982,8 @@ This module is available only for Windows Server 2012 or 2012 R2, and works with This module can only manage a single SQL Server version on a host (one and only one of SQL Server 2012, 2014 or 2016). The module is able to manage multiple SQL Server instances of the same version. +The SQL Server Native Client SDK (also known as SNAC_SDK) can not be managed by this module. The SQL Server installation media is able to install the SDK but is not able to uninstall the SDK. Note that the 'sqlserver_features' fact will detect the presence of the SDK. + ## Development This module was built by Puppet specifically for use with Puppet Enterprise (PE).