-
Notifications
You must be signed in to change notification settings - Fork 226
/
Copy pathsuffix.ps1
26 lines (26 loc) · 930 Bytes
/
suffix.ps1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
<#
This check is made so that the real SqlServer or SQLPS module is not loaded into
the session when the CI runs unit tests of SqlServerDsc. It would conflict with
the stub types and stub commands used in the unit tests. This is a workaround
because we cannot set a specific module as a nested module in the module manifest,
the user must be able to choose to use either SQLPS or SqlServer.
#>
if (-not $env:SqlServerDscCI)
{
try
{
<#
Import SQL commands and types into the session, so that types used
by commands can be parsed.
#>
Import-SqlDscPreferredModule -ErrorAction 'Stop'
}
catch
{
<#
It is not possible to throw the error from Import-SqlDscPreferredModule
since it will just fail the command Import-Module with an obscure error.
#>
Write-Warning -Message $_.Exception.Message
}
}