Schema error: expected dict for dictionary value @ data['actions'] in curator

3.1k Views Asked by At

I have installed curator-5.8.1 but can see its not working from day one.

Getting below error in /var/log/curator_snapshot_backup.log

2021-07-21 02:00:02,232 ERROR     Schema error: expected dict for dictionary value @ data['actions']
2021-07-22 02:00:05,408 ERROR     Schema error: expected dict for dictionary value @ data['actions']
2021-07-23 02:00:08,351 ERROR     Schema error: expected dict for dictionary value @ data['actions']

below is cron entry to run

#Ansible: Curator Delete indices
0 0 * * * /root/curatorvenv/bin/python3 /opt/curator-5.8.1/run_curator.py --config /opt/curator-5.8.1/curator.yaml /opt/curator-5.8.1/actions/delete_indices.yml
#Ansible: Curator Backup all indices
0 2 * * * /root/curatorvenv/bin/python3 /opt/curator-5.8.1/run_curator.py --config /opt/curator-5.8.1/curator.yaml /opt/curator-5.8.1/actions/snapshot_backup.yml >> /var/log/curator_snapshot_backup.log 2>&1

Config file -

cat /opt/curator-5.8.1/curator.yaml

---
# Ansible managed
# Remember, leave a key empty if there is no value.  None will be a string,
# not a Python "NoneType"
client:
  hosts: ['http://10.191.191.100:5200', 'http://10.191.191.101:5200', 'http://10.191.191.102:5200']
  port: 5200
  url_prefix:
  use_ssl: False
  certificate:
  client_cert:
  client_key:
  aws_key:
  aws_secret_key:
  aws_region:
  ssl_no_validate: False
  http_auth: elastic:xxx
  timeout: 30
  master_only: False

logging:
  loglevel: INFO
  logfile:
  logformat: default
  blacklist: ['elasticsearch', 'urllib3']

delete action is

cat /opt/curator-5.8.1/actions/delete_indices.yml

# Ansible managed
actions:
  1:
    action: delete_indices
    description: >-
      Delete indices older than 60 days (based on index name).
    options:
      ignore_empty_list: True
      timeout_override:
      continue_if_exception: True
      disable_action: False
    filters:
    - filtertype: pattern
      kind: prefix
      value: metricbeat
      exclude:
    - filtertype: age
      source: name
      direction: older
      timestring: "%Y.%m.%d"
      unit: days
      unit_count: 60
      exclude:
  2:
    action: delete_indices
    description: >-
      Delete indices older than 60 days (based on index name).
    options:
      ignore_empty_list: True
      timeout_override:
      continue_if_exception: True
      disable_action: False
    filters:
    - filtertype: pattern
      kind: prefix
      value: heartbeat
      exclude:
    - filtertype: age
      source: name
      direction: older
      timestring: "%Y.%m.%d"
      unit: days
      unit_count: 60
      exclude:
  3:
    action: delete_indices
    description: >-
      Delete indices older than 60 days (based on index name).
    options:
      ignore_empty_list: True
      timeout_override:
      continue_if_exception: True
      disable_action: False
    filters:
    - filtertype: pattern
      kind: prefix
      value: filebeat
      exclude:
    - filtertype: age
      source: name
      direction: older
      timestring: "%Y.%m.%d"
      unit: days
      unit_count: 60
      exclude:
  4:
    action: delete_indices
    description: >-
      Delete indices older than 60 days (based on index name).
    options:
      ignore_empty_list: True
      timeout_override:
      continue_if_exception: True
      disable_action: False
    filters:
    - filtertype: pattern
      kind: prefix
      value: .monitoring
      exclude:
    - filtertype: age
      source: name
      direction: older
      timestring: "%Y.%m.%d"
      unit: days
      unit_count: 3
      exclude:
[root@ ~]# cat /opt/curator-5.8.1/actions/snapshot_backup.yml
# Ansible managed
actions:
[root@ ~]#

Can someone point me where is the issue?

Thanks,

2

There are 2 best solutions below

2
Ayush Gupta On

It is likely that something here is causing the YAML to be misinterpreted. A bad spacing may be.Use any yml validators to validate your yml file.

5
untergeek On

You prefaced the client config with triple-dashes, indicating that it is a YAML file. It is okay to have commented lines after the triple-dash header. Your action file seems to be missing the triple-dash header, but starts with a comment line, which can break YAML compatibility.

Update:

I responded from vacation on a mobile device. I see what's going on now. Curator expects actions to be a dictionary. Because actions has no sub key/value pairs in the snapshot_backup.yml file, it appears to be a simple key/value pair itself, rather than a dictionary, which is what the error is indicating.

The bottom line: Calling Curator without any defined actions will result in this or other errors. It's not exactly invalid YAML, but it's not schema correct (which is what the error states).