Skip to content

Commit

Permalink
fix: dont error with enable on create (#288)
Browse files Browse the repository at this point in the history
* fix: dont error with enable on create

* Create 288-fix-agent-schedule.yml

* chore: release info
  • Loading branch information
lowlydba authored Dec 8, 2024
1 parent 4b17fda commit e81d9f9
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 4 deletions.
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

0 comments on commit e81d9f9

Please sign in to comment.