I have setup a Rundeck job in project A that enables/disables schedule on a job in project B. I had this working for a month and now it’s throwing this error:
{"error":true,"apiversion":47,"errorCode":"unauthorized","message":"(Token:G74m****) is not authorized for: /api/21/job/job-id/schedule/enable"}
Does that mean the token expired? How can I create a token that doesn’t expire?
Job definition:
- defaultTab: nodes
description: This job can be used to disable and enable the releases schedule.
executionEnabled: true
group: Releases
id:
loglevel: INFO
name: Disable-Enable Schedules
nodeFilterEditable: false
options:
- hidden: true
name: RUNDECK_AUTH_TOKEN
secure: true
storagePath: keys/project/developer-tools/RUNDECK_AUTH_TOKEN
valueExposed: true
- enforced: true
label: Release Schedule Action
name: ReleaseScheduleAction
required: true
values:
- Disable
- Enable
valuesListDelimiter: ','
plugins:
ExecutionLifecycle: {}
scheduleEnabled: true
sequence:
commands:
- description: Disable and/or Enable Schedules
script: |-
#!/bin/bash
if [ $RD_OPTION_RELEASESCHEDULEACTION == "Disable" ]
then
curl --location --request POST 'https://rundeck.xxx.dev/api/21/job/job-id/schedule/disable'
--header 'Accept: application/json'
--header 'X-Rundeck-Auth-Token: @option.RUNDECK_AUTH_TOKEN@'
--header 'Content-Type: application/json'
--data ''
else
curl --location --request POST 'https://rundeck.xxx.dev/api/21/job/job-id/schedule/enable'
--header 'Accept: application/json'
--header 'X-Rundeck-Auth-Token: @option.RUNDECK_AUTH_TOKEN@'
--header 'Content-Type: application/json'
--data ''
fi
keepgoing: false
pluginConfig:
LogFilter:
- config:
color: yellow
replacement: '[SECURE]'
type: mask-passwords
strategy: node-first
uuid:
Thanks.