Skip to content
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

fix: dont error with enable on create #288

Merged
merged 4 commits into from
Dec 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,19 @@ lowlydba.sqlserver Release Notes

.. contents:: Topics

v2.3.6
======

Release Summary
---------------

Bugfix for creating agent job schedules as explicitly enabled.

Bugfixes
--------

- Fix error when creating an agent job schedule with `enabled` as true. (https://github.com/lowlydba/lowlydba.sqlserver/pull/288)

v2.3.5
======

Expand Down
8 changes: 8 additions & 0 deletions changelogs/changelog.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -523,3 +523,11 @@ releases:
fragments:
- 287-login-bugfix.yml
release_date: '2024-12-08'
2.3.6:
changes:
bugfixes:
- Fix error when creating an agent job schedule with `enabled` as true. (https://github.com/lowlydba/lowlydba.sqlserver/pull/288)
release_summary: Bugfix for creating agent job schedules as explicitly enabled.
fragments:
- 288-fix-agent-schedule.yml
release_date: '2024-12-08'
2 changes: 1 addition & 1 deletion galaxy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

namespace: lowlydba
name: sqlserver
version: 2.3.4
version: 2.3.6
readme: README.md
authors:
- John McCall (github.com/lowlydba)
Expand Down
6 changes: 3 additions & 3 deletions plugins/modules/agent_job_schedule.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -101,11 +101,11 @@ if ($null -ne $frequencyRecurrenceFactor) {
try {
$existingSchedule = Get-DbaAgentSchedule -SqlInstance $SqlInstance -SqlCredential $sqlCredential -Schedule $schedule
if ($state -eq "present") {
if ($enabled -eq $true) {
$scheduleParams.Add("Enabled", $true)
}
# Update schedule
if ($null -ne $existingSchedule) {
if ($enabled -eq $true) {
$scheduleParams.Add("Enabled", $true)
}
# Need to serialize to prevent SMO auto refreshing
$old = ConvertTo-SerializableObject -InputObject $existingSchedule -UseDefaultProperty $false
$output = Set-DbaAgentSchedule @scheduleParams
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@
lowlydba.sqlserver.agent_job_schedule:
schedule: "{{ forced_schedule_name }}"
force: true
enabled: true
state: present
register: result
- assert:
Expand Down
Loading