# Curator -- Getting AttributeError: 'str' object has no attribute 'items'

**URL:** <https://discuss.elastic.co/t/curator-getting-attributeerror-str-object-has-no-attribute-items/171569>\
**Category:** Elasticsearch\
**Tags:** curator\
**Created:** [March 8, 2019, 10:28pm UTC](https://discuss.elastic.co/t/curator-getting-attributeerror-str-object-has-no-attribute-items/171569 "2019-03-08T22:28:54Z")\
**Posts on this page:** 15\
**Page:** 1

<div class="post-metadata">

**Author:** ![Vikas1](https://avatars.discourse-cdn.com/v4/letter/v/e495f1/32.png) [@Vikas1](https://discuss.elastic.co/u/Vikas1)\
**Post date:** [March 8, 2019, 10:28pm UTC](https://discuss.elastic.co/t/curator-getting-attributeerror-str-object-has-no-attribute-items/171569/1 "2019-03-08T22:28:54Z")

</div>

## Attached is my config file

client:  
hosts:  
use\_ssl:True  
certificate:''  
ssl\_no\_validate:False  
timeout:90  
master\_only:False

# 

logging:  
loglevel:DEBUG  
logfile:'/elasticsearch/logs/curator.log'  
logformat:default  
blacklist:['elasticsearch', 'urllib3']

actions file :

actions:  
1:  
action: delete\_indices  
description: "Delete selected indices"  
options:  
ignore\_empty\_list: False  
timeout\_override: 300  
continue\_if\_exception: False  
disable\_action: False  
filters:  
- filtertype: pattern  
kind : prefix  
value: logstash  
- filtertype: age  
source: creation\_date  
direction: older  
unit: days  
unit\_count: 1

---

<div class="post-metadata">

**Author:** ![theuntergeek](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/theuntergeek/32/44961_2.png) [@theuntergeek](https://discuss.elastic.co/u/theuntergeek)\
**Post date:** [March 8, 2019, 10:42pm UTC](https://discuss.elastic.co/t/curator-getting-attributeerror-str-object-has-no-attribute-items/171569/2 "2019-03-08T22:42:27Z")

</div>

Please encapsulate your pasted config data inside triple back ticks, like this:

````
```
PASTE HERE
```

````

Without this, I can't tell if the YAML is properly indented and formatted.

---

<div class="post-metadata">

**Author:** ![Vikas1](https://avatars.discourse-cdn.com/v4/letter/v/e495f1/32.png) [@Vikas1](https://discuss.elastic.co/u/Vikas1)\
**Post date:** [March 8, 2019, 10:44pm UTC](https://discuss.elastic.co/t/curator-getting-attributeerror-str-object-has-no-attribute-items/171569/3 "2019-03-08T22:44:44Z")

</div>

```auto
---
client:
  hosts:
  use_ssl:True
  certificate:'/elasticsearch/certs/ca.crt'
  ssl_no_validate:False
  timeout:90
  master_only:False
#
logging:
  loglevel:DEBUG
  logfile:'/elasticsearch/logs/curator.log'
  logformat:default
  blacklist:[]

```

---

<div class="post-metadata">

**Author:** ![Vikas1](https://avatars.discourse-cdn.com/v4/letter/v/e495f1/32.png) [@Vikas1](https://discuss.elastic.co/u/Vikas1)\
**Post date:** [March 8, 2019, 10:53pm UTC](https://discuss.elastic.co/t/curator-getting-attributeerror-str-object-has-no-attribute-items/171569/4 "2019-03-08T22:53:15Z")

</div>

Here is the actions file as well

```auto
actions:
 1:
 action:delete_indices
 description:"Delete selected indices"
 options:
    ignore_empty_list:False
    timeout_override:300
    continue_if_exception:False
    disable_action:False
  filters:
      - filtertype:pattern
        kind:prefix
        value:logstash
      - filtertype:age
        source:creation_date
        direction:older
        unit:days
        unit_count:1

```

---

<div class="post-metadata">

**Author:** ![theuntergeek](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/theuntergeek/32/44961_2.png) [@theuntergeek](https://discuss.elastic.co/u/theuntergeek)\
**Post date:** [March 8, 2019, 11:16pm UTC](https://discuss.elastic.co/t/curator-getting-attributeerror-str-object-has-no-attribute-items/171569/5 "2019-03-08T23:16:35Z")

</div>

There are two problems I see.

1. YAML requires a space between the colon after a key name (and before the value).
2. The indentation was incorrect.

This is a corrected example based on what you provided:

```auto
actions:
  1:
    action: delete_indices
    description: "Delete selected indices"
    options:
      ignore_empty_list: False
      timeout_override: 300
      continue_if_exception: False
      disable_action: False
    filters:
    - filtertype: pattern
      kind: prefix
      value: logstash
    - filtertype: age
      source: creation_date
      direction: older
      unit: days
      unit_count: 1

```

---

<div class="post-metadata">

**Author:** ![Vikas1](https://avatars.discourse-cdn.com/v4/letter/v/e495f1/32.png) [@Vikas1](https://discuss.elastic.co/u/Vikas1)\
**Post date:** [March 8, 2019, 11:55pm UTC](https://discuss.elastic.co/t/curator-getting-attributeerror-str-object-has-no-attribute-items/171569/6 "2019-03-08T23:55:15Z")

</div>

Thansk aaron for that. Does the config file has proper indentation ?

---

<div class="post-metadata">

**Author:** ![theuntergeek](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/theuntergeek/32/44961_2.png) [@theuntergeek](https://discuss.elastic.co/u/theuntergeek)\
**Post date:** [March 9, 2019, 12:58am UTC](https://discuss.elastic.co/t/curator-getting-attributeerror-str-object-has-no-attribute-items/171569/7 "2019-03-09T00:58:20Z")

</div>

The indentation is okay for the config file, but you need to add spaces after the colons for each key, e.g.

```auto
use_ssl: true

```

(`true` and `false` don't need to be capitalized, but it will work either way)

---

<div class="post-metadata">

**Author:** ![Vikas1](https://avatars.discourse-cdn.com/v4/letter/v/e495f1/32.png) [@Vikas1](https://discuss.elastic.co/u/Vikas1)\
**Post date:** [March 20, 2019, 7:29pm UTC](https://discuss.elastic.co/t/curator-getting-attributeerror-str-object-has-no-attribute-items/171569/8 "2019-03-20T19:29:27Z")

</div>

Thanks aaron for that. I got everything worked out now. The only thing that I have hard time is using certificate file for ssl authentication. Attached is my config file. It gives me authentication error. Just to add , It works perfectly fine if I change the ssl\_no\_validate to true.

```auto
---
client:
  hosts: 
  use_ssl: true
  certificate: '/logstash/certs/us-xplore-dev/ca.crt'
  ssl_no_validate: false
  timeout: 90
  http_auth: 
  master_only: false
#
logging:
  loglevel: DEBUG
  logfile: '/logstash/curator/curator.log'
  logformat: default
  blacklist: []

```

But I get this following error :  
/usr/local/lib/python2.7/dist-packages/curator/utils.py:53: YAMLLoadWarning: calling yaml.load() without Loader=... is deprecated, as the default Loader is unsafe. Please read [https://msg.pyyaml.org/load](https://msg.pyyaml.org/load) for full details.  
return yaml.load(read\_file(path))  
Traceback (most recent call last):  
File "/usr/local/bin/curator", line 11, in   
sys.exit(cli())  
File "/usr/local/lib/python2.7/dist-packages/click/core.py", line 722, in **call**  
return self.main(\*args, \*\*kwargs)  
File "/usr/local/lib/python2.7/dist-packages/click/core.py", line 697, in main  
rv = self.invoke(ctx)  
File "/usr/local/lib/python2.7/dist-packages/click/core.py", line 895, in invoke  
return ctx.invoke(self.callback, \*\*ctx.params)  
File "/usr/local/lib/python2.7/dist-packages/click/core.py", line 535, in invoke  
return callback(\*args, \*\*kwargs)  
File "/usr/local/lib/python2.7/dist-packages/curator/cli.py", line 213, in cli  
run(config, action\_file, dry\_run)  
File "/usr/local/lib/python2.7/dist-packages/curator/cli.py", line 160, in run  
client = get\_client(\*\*client\_args)  
File "/usr/local/lib/python2.7/dist-packages/curator/utils.py", line 906, in get\_client  
'Error: {0}'.format(e)  
elasticsearch.exceptions.ElasticsearchException: Unable to create client connection to Elasticsearch. Error: ConnectionError(hostname u'112.16.116.185' doesn't match either of 'elasticsearch1', '112.16.116.185') caused by: SSLError(hostname u'112.16.116.185' doesn't match either of 'elasticsearch1', '112.16.116.185')

---

<div class="post-metadata">

**Author:** ![theuntergeek](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/theuntergeek/32/44961_2.png) [@theuntergeek](https://discuss.elastic.co/u/theuntergeek)\
**Post date:** [March 20, 2019, 8:04pm UTC](https://discuss.elastic.co/t/curator-getting-attributeerror-str-object-has-no-attribute-items/171569/9 "2019-03-20T20:04:42Z")

</div>

What did you use to generate those certificates? It appears you are doing full hostname validation, as it's checking for `elasticsearch1` or the IP. Is the remote Elasticsearch configured to expect [`full` verification for `ssl.verification_mode`](https://www.elastic.co/guide/en/elasticsearch/reference/6.6/security-settings.html#ssl-tls-settings)? I recommend using `certificate` for these self-signed ones, or you should probably build them with fully-qualified domain names, instead of just IPs and short host names.

---

<div class="post-metadata">

**Author:** ![Vikas1](https://avatars.discourse-cdn.com/v4/letter/v/e495f1/32.png) [@Vikas1](https://discuss.elastic.co/u/Vikas1)\
**Post date:** [March 20, 2019, 8:18pm UTC](https://discuss.elastic.co/t/curator-getting-attributeerror-str-object-has-no-attribute-items/171569/10 "2019-03-20T20:18:42Z")

</div>

So when you mean use certificate for self signed ones , does that mean just use the http\_auth with certificate ?.

---

<div class="post-metadata">

**Author:** ![theuntergeek](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/theuntergeek/32/44961_2.png) [@theuntergeek](https://discuss.elastic.co/u/theuntergeek)\
**Post date:** [March 20, 2019, 8:46pm UTC](https://discuss.elastic.co/t/curator-getting-attributeerror-str-object-has-no-attribute-items/171569/11 "2019-03-20T20:46:27Z")

</div>

I'm making some assumptions here.

1. You're using Elastic's Security (formerly known as xpack)
2. You are generating the certificates with Elastic's [`certutil`](https://www.elastic.co/guide/en/elasticsearch/reference/6.6/certutil.html) command.

Is this accurate?

---

<div class="post-metadata">

**Author:** ![Vikas1](https://avatars.discourse-cdn.com/v4/letter/v/e495f1/32.png) [@Vikas1](https://discuss.elastic.co/u/Vikas1)\
**Post date:** [March 20, 2019, 9:07pm UTC](https://discuss.elastic.co/t/curator-getting-attributeerror-str-object-has-no-attribute-items/171569/12 "2019-03-20T21:07:20Z")

</div>

yes that is accurate aaron.

---

<div class="post-metadata">

**Author:** ![Vikas1](https://avatars.discourse-cdn.com/v4/letter/v/e495f1/32.png) [@Vikas1](https://discuss.elastic.co/u/Vikas1)\
**Post date:** [March 20, 2019, 9:13pm UTC](https://discuss.elastic.co/t/curator-getting-attributeerror-str-object-has-no-attribute-items/171569/13 "2019-03-20T21:13:26Z")

</div>

Just wanted to confirm , do I need to mention the dns as well in the config file , instead of just giving the IP ?

---

<div class="post-metadata">

**Author:** ![theuntergeek](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/theuntergeek/32/44961_2.png) [@theuntergeek](https://discuss.elastic.co/u/theuntergeek)\
**Post date:** [March 20, 2019, 10:11pm UTC](https://discuss.elastic.co/t/curator-getting-attributeerror-str-object-has-no-attribute-items/171569/14 "2019-03-20T22:11:08Z")

</div>

Apparently, your certificate only has `'elasticsearch1'`, and `'112.16.116.185'` associated with it. You specified this when you created the certificates. Elasticsearch is trying to verify these values, and it's not able to do so. I recommend setting

```auto
xpack.ssl.verification_mode: certificate

```

…in your `elasticsearch.yml` file so that the certificate Curator is using only has to be signed by the same certificate authority that created the ones you made for your Elasticsearch nodes.

If you can't, I recommend creating new certificates that are based not on short name and IP, but on a fully-qualified domain name, and making an extra one for Curator, if needed. If Curator is running on one of your existing hosts, you can re-use its certificate.

You could _also_ try to just put `elasticsearch1` in your `hosts` array in the Curator YAML file, but FQDN is better.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [April 17, 2019, 10:11pm UTC](https://discuss.elastic.co/t/curator-getting-attributeerror-str-object-has-no-attribute-items/171569/15 "2019-04-17T22:11:08Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
