-
Notifications
You must be signed in to change notification settings - Fork 225
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
SqlSetup: Seems to evaluate the SourcePath
too early for Puppet
#1946
Comments
If "loading facts" stage runs the method Get on all DSC resources then the media must be available at that point since the version of the media (the version of setup.exe) is used to determine the version that is gonna be installed (media must be available for all methods, Get, Test, and Set). |
Is it possible to tell Puppet not to evaluate SqlSetup until runtime? |
SourcePath
too early for Puppet
Another option is let SqlSetup do this copy by adding |
I thought I had done all that by trying dependencies, virtual resources, and run stages, but if there's a way to delay Puppet calling Get-TargetResource until later, I'm not sure. I took a look at the source code for sqlsetup and tried playing around by adding an optional "SqlVersion" parameter that would obviate the need for SourcePath during Get-TargetResource. I got too far in the weeds and decided to go another route. It looks like the SourceCredential option wouldn't work for me... the "corporate file share" I mentioned is actually in an Azure storage file share, which is not as easily accessible, so the steps to download the ISO and extract it require more work than sqlsetup can handle. I've worked around this for now by simply requiring our team to download and extract the ISO before applying the sqlsetup module. This two step process is less than ideal, but at least it gets me to the end goal. |
That was a thought I had too when I read this issue. I think it would be easy enough to just set
Since it would be optional it wouldn't break anything else. |
- SqlSetup - Added the parameter `SqlVersion` that can be used to set the SQL Server version to be installed instead of it looking for version in the setup executable of the SQL Server media. This parameter is not allowed for the setup action `Upgrade`, if specified it will throw an exception (issue #1946).
@unkinected I pushed this change in 16.5.0-preview0001 - try it and report back if there are any issues. |
Problem description
I'm implementing sqlsetup using puppet. In my puppet module, my first step is to copy the iso from a corporate file share and extract it, the second step is to install SQL using sqlsetup, specifying the sourcepath as the local directory from step 1.
Unfortunately the code won't ever work because sqlsetup is somehow evaluating the sourcepath before anything else (technically, it's happening in the puppet "loading facts" stage). Because my directory doesn't exist until the module runs, and loading facts comes before the module gets applied, the whole thing fails. This happens no matter how I try to build a dependency tree... dependencies, virtual resources, run stages. If sqlsetup is declared/realized anywhere in my module, it tries to evaluate the sourcepath in the loading facts stage and kills the rest of the process.
The exact error depends on whether I've extracted the ISO to a directory or just mounted it as a drive, but generally follows like this:
C:\WINDOWS\system32>puppet agent -t Info: Using environment 'production' Info: Retrieving pluginfacts Info: Retrieving plugin Info: Loading facts Error: dsc_sqlsetup: Cannot find drive. A drive with the name 'S' does not exist.
In the debug log I don't see anything related to sql during the loading facts stage, so I'm not sure what's going on in the above error.
Verbose logs
DSC configuration
Suggested solution
Evaluation of sourcepath should not happen until the sqlsetup resource is run.
SQL Server edition and version
SQL Server PowerShell modules
Operating system
PowerShell version
SqlServerDsc version
The text was updated successfully, but these errors were encountered: