Skip to content

retry_pattern: minutes is no working in case of multi task retry  #360

@leralik

Description

@leralik

see below my template :

name: patch
description: patch connections
long_description: patch connections
doc_link: https://en.wikipedia.org/wiki/%22Hello,_World!%22_program

title_format: patch connections

allowed_resolver_usernames: []
allow_all_resolver_usernames: true
auto_runnable: true
blocked: false
hidden: false

retry_max: 100

inputs:

  • name: tower_url
    description: tower_url
    optional: true
    default: '{{.config.towerurl}}'

  • name: tower_endpoint
    description: tower_endpoint
    optional: true
    default: '{{.config.towerendpoint}}'

  • name: hosts_list
    description: hosts_list
    optional: true

  • name: create_snapshot
    description: create_snapshot
    optional: true

  • name: erratas
    description: erratas
    optional: true

  • name: mailAddress
    description: mailAddress
    optional: true

  • name: reboot
    description: reboot
    optional: true

  • name: remove_snapshot
    description: remove_snapshot
    optional: true

  • name: kafka_url
    description: kafka url
    optional: true

  • name: kafka_message
    description: kafka message
    optional: true

  • name: kafka_key
    description: kafka key
    optional: true
    runPatch:
    description: run patch via ansible tower
    action:
    type: http
    configuration:
    method: POST
    url: '{{.config.towerurl}}{{.config.towerendpoint}}'
    auth:
    basic:
    user: '{{.config.toweruser}}'
    password: '{{.config.towerpassword}}'
    insecure_skip_verify: "true"
    headers:
    - name: Content-Type
    value: "application/json"
    - name: Accept
    value: "application/json"
    body: |-
    {
    "extra_vars":
    {
    "hosts_list": "{{.input.hosts_list}}",
    "create_snapshot": "{{.input.create_snapshot}}",
    "erratas": "{{.input.erratas}}",
    "mailAddress": "{{.input.mailAddress}}",
    "reboot": "{{.input.reboot}}",
    "remove_snapshot": "{{.input.remove_snapshot}}"
    }
    }

    getStatus:
    description: get status from tower job
    dependencies: [runPatch]
    action:
    type: http
    configuration:
    method: GET
    #timeout_seconds: "2"
    url: '{{.config.towerurl}}/api/v2/jobs/{{.step.runPatch.output.job}}/'
    insecure_skip_verify: "true"
    auth:
    basic:
    user: '{{.config.toweruser}}'
    password: '{{.config.towerpassword}}'
    conditions:
    - type: check
    if:
    - value: '{{.step.getStatus.metadata.HTTPStatus}}'
    operator: GE
    expected: '300'
    then:
    this: FATAL_ERROR
    message: 'FAILED'

    getContent:
    description: get status from tower job
    dependencies: [runPatch]
    #timeout: "5s"
    action:
    type: http
    configuration:
    method: GET
    #timeout_seconds: "2"
    url: '{{.config.towerurl}}/api/v2/jobs/{{.step.runPatch.output.job}}/stdout/?format=json'
    insecure_skip_verify: "true"
    auth:
    basic:
    user: '{{.config.toweruser}}'
    password: '{{.config.towerpassword}}'
    conditions:
    - type: skip
    if:
    - value: '{{.step.getStatus.output.status}}'
    operator: NE
    expected: 'failed'
    then:
    this: DONE

    informKafka:
    dependencies: [getContent,getStatus]
    description: post message to kafka regarding patch progress
    retry_pattern: minutes
    action:
    type: http
    configuration:
    method: POST
    #timeout_seconds: "2"
    url: '{{.config.kafkaurl}}'
    headers:
    - name: Content-Type
    value: "application/vnd.kafka.json.v2+json"
    - name: Accept
    value: "application/vnd.kafka.v2+json"
    #"records":[{"key":"{{.step.runPatch.output.job}}","value": "{{.step.getStatus.output.status}}"
    body: |-
    {
    "records":[{"key":"{{.step.runPatch.output.job}}_request_ID", "value": "[{'id': '{{.step.runPatch.output.job}}','status':'{{.step.getStatus.output.status}}','comments': '','failureReason': '{{.step.getContent.output.content}}','category': 'patch','userName': 'ansible'}]"}]
    }

    conditions:
    - type: check
    if:
    - value: 'failed,successful'
    operator: NOTIN
    expected: '{{.step.getStatus.output.status}}'
    then:
    this: TO_RETRY
    getContent: TO_RETRY
    getStatus: TO_RETRY

    - type: skip
      if:
      - value: '{{.step.getStatus.output.status}}'
        operator: EQ
        expected: '<no value>'
      then:
        this: TO_RETRY
    

Retry mechanism is running every 10 sec , doesn't matter what i put in retry_pattern

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions