Trying to use the curator API. I want to do a backup of all my indices and
only if the snapshot backup is successful, trim any snapshots older than 5
days.
First part is simple enough, but I don't see any return for create_snapshot:
bash-4.1# cat test.py
#!/usr/bin/env python
import elasticsearch
import curator
repo_name = 'test'
client = elasticsearch.Elasticsearch(host="localhost", port=9200, timeout=
21600)
backup_status = curator.create_snapshot(client, repository=repo_name)
print(backup_status)
if backup_status == None:
print("Trimming snapshots older than 10 days.")
curator.snapshot(client, all_indices=True, repository=repo_name,
delete_older_than=10, time_unit="days")
else:
print("Backup failed: Not trimming snapshots.")
bash-4.1# ./test.py
None
Trimming snapshots older than 10 days.
Traceback (most recent call last):
File "./test.py", line 12, in
curator.snapshot(client, all_indices=True, repository=repo_name,
delete_older_than=10, time_unit="days")
File "/usr/lib/python2.6/site-packages/curator/curator.py", line 1092, in
snapshot
matching_snapshots = list(filter_by_timestamp(object_list=snapshot_list,
object_type='snapshot', **kwargs))
File "/usr/lib/python2.6/site-packages/curator/curator.py", line 354, in
filter_by_timestamp
dateregex = get_date_regex(timestring)
File "/usr/lib/python2.6/site-packages/curator/curator.py", line 32, in
get_date_regex
for s in range(0, len(timestring)):
TypeError: object of type 'NoneType' has no len()
This is using version 2.0.2.
--
You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elasticsearch+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/01462b51-574d-4469-afe0-9e362eaf4a3c%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.