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
SqlDatabaseMail: Unable to create two DB mail profiles #1871
Comments
Is it possible for you to add the verbose logs that shows the error being thrown. That configuration could be added to the integration tests to see if it can reproduce the problem. 🤔 |
I'm sorry, thought I already included them Here they are.
|
Ah, sorry. I misread. I thought you got the error you mentioned when you run the configuration. Now I understand that the configuration passes without any error. That is strange. Have you run the same configuration on two different instances to verify it happens every time? |
Thank you. On the very last three lines of the verbose above say: VERBOSE: [AMSQLDEV02]: [[SqlDatabaseMail]CreateNLHSQLMaintNotifyProfile] Determines if the Database Mail is in the desired state. VERBOSE: [AMSQLDEV02]: LCM: [ End Test ] [[SqlDatabaseMail]CreateNLHSQLMaintNotifyProfile] False in 0.9220 seconds. VERBOSE: [AMSQLDEV02]: LCM: [ End Resource ] [[SqlDatabaseMail]CreateNLHSQLMaintNotifyProfile] So that it shows the failure but continues anyways. Yes, I've run it a good dozen times, with a failure each time. I even tried pulling the 2nd profile into its own block. The 2nd one is created but is corrupt. Is there anyone that can try to replicate this finding? We have lots of servers that need both profiles. |
Ah, you mean Test-method returns False when it avoids return True. I see you have a space at the end of the string in these two properties. AccountName = "NLH SQL Maint Notify ";
ProfileName = "NLH SQL Maint Notify "; If you change it too It was a difference from the previous one, so just to make sure it is not the problem. |
I'll give it a try now. Thank you. |
Yes, I just tried it and it failed. :( |
It was worth a try, just to exclude it. Suggest extend the integration tests in a PR (Pull Request) to see if it is possible to reproduce the problem using the pipeline. |
I'm not doing pulls just pushes. I'm not setup for pulls. The problem is easily replicated. Do I have any other course of action to fix this? |
Ah sorry, I meant a GitHub Pull Request - contributing the configuration to the integration tests of this repo. Adding the configuration to this file: https://github.com/dsccommunity/SqlServerDsc/blob/main/tests/Integration/DSC_SqlDatabaseMail.config.ps1 And testing the outcome in this file: https://github.com/dsccommunity/SqlServerDsc/blob/main/tests/Integration/DSC_SqlDatabaseMail.Integration.Tests.ps1 Similar to how the other exiting configs are tested. |
Confirmed that Test-method fails with the configuration added to the integration tests in PR #1922. Output:
|
After changing the code to output better verbose messages it seems there is a bug gathering the current state
|
Thank you for the good progress. We appreciate your time.
…____________________
Alex Moreno, Jr., MCDBA, MA Engr. Mathematics
Database Administrator, Data Center Operations | Optum Insight
Supporting Northern Light Health
O 207.553.3060
***@***.******@***.***>
43 Whiting Hill Road
Brewer, ME 04412
From: Johan Ljunggren ***@***.***>
Sent: Tuesday, April 25, 2023 9:47 AM
To: dsccommunity/SqlServerDsc ***@***.***>
Cc: Moreno Jr, Alejandro ***@***.***>; Author ***@***.***>
Subject: Re: [dsccommunity/SqlServerDsc] SqlDatabaseMail: Unable to create two DB mail profiles (Issue #1871)
*****************************************************************************************************************
The e-mail below is from an external source. Please do not open attachments or click links from an unknown or suspicious source. *****************************************************************************************************************
After changing the code to output better verbose messages it seems there is a bug gathering the current state
https://dev.azure.com/dsccommunity/SqlServerDsc/_build/results?buildId=7884&view=logs&j=b737e19f-7a5b-5102-d0bd-68dc73521599&t=7bcc29f5-56f8-577a-d17b-1f044c471130&l=5504<https://dev.azure.com/dsccommunity/SqlServerDsc/_build/results?buildId=7884&view=logs&j=b737e19f-7a5b-5102-d0bd-68dc73521599&t=7bcc29f5-56f8-577a-d17b-1f044c471130&l=5504>
2023-04-25T12:34:43.0351479Z VERBOSE: [WIN-2A8EF7ASEQJ]: [[SqlDatabaseMail]CreateMaintenanceNotifyProfile] NOTMATCH:
2023-04-25T12:34:43.0352187Z Value (type 'System.String') for property 'ProfileName' does not match. Current state is 'Company SQL Alerts' and
2023-04-25T12:34:43.0354176Z desired state is 'Company SQL Maintenance Notify'. (DRC0021)
—
Reply to this email directly, view it on GitHub<#1871 (comment)>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/A6KFGROULWOPJFMGVU7WGF3XC7IVZANCNFSM6AAAAAAVWPGSGU>.
You are receiving this because you authored the thread.Message ID: ***@***.******@***.***>>
|
It looks like the bug is here.
And here
We didn't hit the first issue since the mail server was the same in both resource instances (in the integration test in the PR). These two rows should not assume that the first value is always the right one. I think the assumption was that the same profile and mail server would always be used. Easy fix I think. |
#1922) - SqlDatabaseMail - Update integration tests to verify multiple instances of SqlDatabaseMail in the same configuration (issue #1871). - Changed comparison logic to use `Compare-DscParameterState` (issue #1871). - Return the correct profile name and mail server name from the current state (issue #1871).
Thanks for reporting this. Fix will be deploy in a preview shortly (as soon as the pipeline finishes). |
Problem description
I tried the following configuration code which is unable to create the two profiles declared. The second profile is corrupt with the message “Object reference not set to an object. (DatabaseMailWizard)”, when trying to access it. The second profile is failing and is corrupt.
Verbose logs
DSC configuration
Suggested solution
I have none.
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: