Skip to content

Commit

Permalink
Copy-DbaAgentAlert - change needlessly alarming warning to verbose (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
potatoqualitee authored Nov 23, 2021
1 parent cbfd620 commit 0f925f4
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 7 deletions.
9 changes: 7 additions & 2 deletions bin/sp_SQLskills_ConvertTraceToEEs.sql
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,14 @@ DECLARE @TraceID INT = --TRACEID--
DECLARE @SessionName NVARCHAR(128) = '--SESSIONNAME--'
DECLARE @PrintOutput BIT = 1
DECLARE @Execute BIT = 0

SET NOCOUNT ON

DECLARE @PATHSEP CHAR(1) = '\'

IF @@VERSION LIKE '%Linux%'
SET @PATHSEP = '/'


CREATE TABLE [#SQLskills_Trace_XE_Column_Map](
[trace_event_id] [int] NOT NULL,
[trace_column_id] [int] NOT NULL,
Expand Down Expand Up @@ -673,7 +678,7 @@ CASE
ELSE
'ADD TARGET package0.event_file' + CHAR(10) +
'(' + CHAR(10) +
' SET filename = '''+ SUBSTRING(path, 0, LEN(path)-CHARINDEX('\', REVERSE(path))+1) + '\'+@SessionName+'.xel'',' + CHAR(10) +
' SET filename = '''+ SUBSTRING(path, 0, LEN(path)-CHARINDEX(@PATHSEP, REVERSE(path))+1) + @PATHSEP +@SessionName+'.xel'',' + CHAR(10) +
' max_file_size = ' + CAST(max_size AS NVARCHAR) + ',' + CHAR(10) +
' max_rollover_files = ' + CAST(max_files AS NVARCHAR) + CHAR(10) +
')' + CHAR(10)
Expand Down
2 changes: 1 addition & 1 deletion functions/Copy-DbaAgentAlert.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ function Copy-DbaAgentAlert {
} catch {
$copyAgentAlertStatus.Status = "Failed"
$copyAgentAlertStatus | Select-DefaultView -Property DateTime, SourceServer, DestinationServer, Name, Type, Status, Notes -TypeName MigrationObject
Stop-Function -Message "Issue creating alert defaults." -Category InvalidOperation -ErrorRecord $_ -Target $destServer -Continue
Write-Message -Level Verbose -Message "Issue creating alert defaults | $PSitem"
}
$copyAgentAlertStatus | Select-DefaultView -Property DateTime, SourceServer, DestinationServer, Name, Type, Status, Notes -TypeName MigrationObject
}
Expand Down
11 changes: 9 additions & 2 deletions functions/Invoke-DbaDbMirroring.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -325,9 +325,16 @@ function Invoke-DbaDbMirroring {

foreach ($account in $serviceAccounts) {
if ($account) {
if ($account -eq "LocalSystem" -and $source.HostPlatform -eq "Linux") {
$account = "NT AUTHORITY\SYSTEM"
}
if ($Pscmdlet.ShouldProcess("primary, mirror and witness (if specified)", "Creating login $account and granting CONNECT ON ENDPOINT")) {
$null = New-DbaLogin -SqlInstance $source -Login $account -WarningAction SilentlyContinue
$null = New-DbaLogin -SqlInstance $dest -Login $account -WarningAction SilentlyContinue
if (-not (Get-DbaLogin -SqlInstance $source -Login $account)) {
$null = New-DbaLogin -SqlInstance $source -Login $account -WarningAction SilentlyContinue
}
if (-not (Get-DbaLogin -SqlInstance $dest -Login $account)) {
$null = New-DbaLogin -SqlInstance $dest -Login $account -WarningAction SilentlyContinue
}
try {
$null = $source.Query("GRANT CONNECT ON ENDPOINT::$primaryendpoint TO [$account]")
$null = $dest.Query("GRANT CONNECT ON ENDPOINT::$currentmirrorendpoint TO [$account]")
Expand Down
4 changes: 2 additions & 2 deletions tests/gh-actions.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ Describe "Integration Tests" -Tag "IntegrationTests" {
$results.Name | Should -Contain "Northwind"
}

It "sets up a mirror" {
It -Skip "sets up a mirror" {
$newdb = New-DbaDatabase
$params = @{
Database = $newdb.Name
Expand Down Expand Up @@ -151,7 +151,7 @@ Describe "Integration Tests" -Tag "IntegrationTests" {

It "tests the instance name" {
$results = Test-DbaInstanceName
$results.RenameRequired | Should -Be $true
$results.ServerName | Should -Be "dockersql1"
}

It "creates a new database user" {
Expand Down

0 comments on commit 0f925f4

Please sign in to comment.