elastic / curator

Curator: Tending your Elasticsearch indices
Other
3.04k stars 634 forks source link

config http_auth work properly,but username and password not #1645

Closed glianyi closed 1 year ago

glianyi commented 2 years ago

To submit a bug or report an issue

docker run --rm -it -e PASSWD=YquqjKRjNUbATtRY -v /root/pengcong/curator:/etc/curator/ 7b2fc07b926d --config /etc/curator/curator.yml /etc/curator/test.yml
Traceback (most recent call last):
  File "/usr/bin/curator", line 14, in <module>
    load_entry_point('elasticsearch-curator==5.8.1', 'console_scripts', 'curator')()
  File "/usr/lib/python2.7/site-packages/click/core.py", line 722, in __call__
    return self.main(*args, **kwargs)
  File "/usr/lib/python2.7/site-packages/click/core.py", line 697, in main
    rv = self.invoke(ctx)
  File "/usr/lib/python2.7/site-packages/click/core.py", line 895, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/usr/lib/python2.7/site-packages/click/core.py", line 535, in invoke
    return callback(*args, **kwargs)
  File "/usr/lib/python2.7/site-packages/curator/cli.py", line 240, in cli
    run(config, action_file, dry_run)
  File "/usr/lib/python2.7/site-packages/curator/cli.py", line 108, in run
    client_args = process_config(config)
  File "/usr/lib/python2.7/site-packages/curator/config_utils.py", line 38, in process_config
    config = test_config(yaml_file)
  File "/usr/lib/python2.7/site-packages/curator/config_utils.py", line 21, in test_config
    'Client Configuration', 'full configuration dictionary').result()
  File "/usr/lib/python2.7/site-packages/curator/validators/schemacheck.py", line 69, in result
    self.test_what, self.location, self.badvalue, self.error)
curator.exceptions.ConfigurationError: Configuration: Client Configuration: Location: full configuration dictionary: Bad Value: "{'username': 'admin', 'hosts': ['10.98.91.211'], 'timeout': 30, 'use_ssl': True, 'password': '**********', 'master_only': False, 'port': 9200, 'ssl_no_validate': True}", extra keys not allowed @ data['client']['username']. Check configuration file.

Specifications

Context (Environment)

curator.yml

client:
  hosts:
    - 10.98.91.211
  port: 9200
  url_prefix:
  use_ssl: True
  certificate:
  client_cert:
  client_key:
  ssl_no_validate: True
  username: "admin"
  password: "**********"
  #http_auth: "admin:************"
  #http_auth: ${PASSWD}
  timeout: 30
  master_only: False

logging:
  loglevel: INFO
  logfile:
  logformat: default
  blacklist: ['elasticsearch', 'urllib3']
untergeek commented 1 year ago

This is stale, so far as Curator v8 is concerned. The reason http_auth isn't working here is because it needs to be a Python Tuple type, and YAML will only interpret it as a string. You can't use that, hence the changes in Curator v8, and popping out username and password the way I did in 5.8.4.