-
How do you people handle errors within the module? I would like the people who run the ansible job to see what the exact error is, but cant seem to find out where the message is returned exactly: For example: How can I access the "warnings" within the ansible playbook? Thanks for your help |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 4 replies
-
That particular error message is defined upstream by the dbatools pwsh module. They have made the choice to put the details as a warning log, and just have the error message tell you to refer back to them. I'm not positive if this will work, but have you tried registering the output and then printing stderr? Something like: - name: Create a database
lowlydba.sqlserver.database:
database: "x"
register: result
- name: Display stderr
debug:
msg: "{{ result.stderr }}" If that doesn't work, then I think it'd mean it would take an enhancement to explicitly capture and display warning messages overall. @briantist Any thoughts? |
Beta Was this translation helpful? Give feedback.
-
@tovoro This will be resolved in version 2.3.4 (released!) The log output for the restore command will now include warnings when it fails: fatal: [runner]: FAILED! => {"changed": false, "failed_when_result": true, "msg": "Error restoring database: Database model_restore unable to be restored, see warnings for details. Additional warnings: [17:24:42][Test-DbaBackupInformation] Database model_restore exists, so WithReplace must be specified [17:24:42][Test-DbaBackupInformation] File C:\\Program Files\\Microsoft SQL Server\\MSSQL16.MSSQLSERVER\\MSSQL\\DATA\\db_model_restore_new.mdf already exists on fv-az731-605 and WithReplace not specified, cannot restore [17:24:42][Test-DbaBackupInformation] File C:\\Program Files\\Microsoft SQL Server\\MSSQL16.MSSQLSERVER\\MSSQL\\DATA\\db_model_restorelog_new.ldf already exists on fv-az731-605 and WithReplace not specified, cannot restore [17:24:42][Restore-DbaDatabase] Database model_restore unable to be restored, see warnings for details."} |
Beta Was this translation helpful? Give feedback.
-
Wow thanks a lot @lowlydba 🙌 |
Beta Was this translation helpful? Give feedback.
@tovoro This will be resolved in version 2.3.4 (released!)
The log output for the restore command will now include warnings when it fails: