-
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
SqlScript: DisableVariables from Invoke-SQLCmd not available #1422
Comments
The cmdlet Should be pretty straightforward change. Happy to review a PR for this! |
@johlju I currently need this feature for a configuration I'm working on. It's been a while since I've used github but I'd like to submit a PR to add this if you don't mind helping me should I run into any issues. I have a few initial questions about the scope/context of this change.
|
@Kreby happy to review a PR for this and happily help with any issues. Due to my day job it can take a while for me to respond though.
A quick search on GitHub (see link) it looks like it is the only two resources that is using the helper function.
Looking here I see the the resource is fully covered using tests. Yes, I would like to see at least a unit tests for this, although the existing unit tests for the DSC resources and the unit tests for the helper function might cover this change as well when I look how it was coded. For some resources we can't make integration tests due to limitations in the build worker. Although in this case I would like to see an integration test as it helps be verify functionality (during review) for this PR and future PR's. 🙂 There are existing integration tests that uses the Variables parameter so that will make sure existing functionality does not break, so you just need to add another integration tests to test this new parameter. I also would like to see an example added to the resource example folder. |
@johlju that all sounds good to me. I'll make sure to include an integration test and an example. I'll have to think about what would work as a good simple test/example 🤔. Looking through the existing tests it does raise a question about the configuration data. I'd need to confirm the behavior first but I'd suspect that using both Variables and DisableVariables would lead to some complications. How would you prefer I work around that in the configuration data? I see different databases listed a Database1Name and Database2Name so should I add 3 additional variables with different scripts that the new test would then use or something else? It might take me a little bit to get up to speed on the tests but I'm going to try to find some time to get started hopefully by the end of the week. |
You should add scripts for these tests as appropriate, but it is optional to add the new properties or scripts to the configuration data. You can "hard-code" them directly in the configuration and integration test(s) if you like. Often we use the values in the configuration data to get the expected values when testing output from |
Hi
I've been trying to use the SqlScript to run a T-SQL that basically create an SQL Agent Job to schedule Ola's Maintenance stored procedures.
Ola's default logging behavior use this output for each step :
As the script is executed by a DSC SqlScript block, the following error is thrown :
The internal SQL variable JOBNAME is detected as a PowerShell variable and DSC is asking to supply that variable.
I know that an option is available with Invoke-SQLCmd to prevent that, DisableVariables.
Is there anything similar that would have not been documented I could use to keep my output_file_name ?
Thanks for your help,
Julfur
The text was updated successfully, but these errors were encountered: