fix: change password for builtin users
This commit is contained in:
parent
f1ba54d2ad
commit
0ab1bd2023
4 changed files with 61 additions and 6 deletions
module_utils
|
@ -20,6 +20,20 @@ class ElasticsearchApi:
|
|||
|
||||
return r.status_code, r.json()
|
||||
|
||||
def post(self, path, data):
|
||||
r = requests.post(
|
||||
'{}/{}'.format(self.url, path),
|
||||
auth=self.basic,
|
||||
json=data
|
||||
)
|
||||
|
||||
if r.status_code == 500:
|
||||
raise Exception('Server return 500 error: {}'.format(r.text))
|
||||
elif r.status_code == 401:
|
||||
raise Exception('Authentification has failed')
|
||||
elif r.status_code != 200:
|
||||
raise Exception('Server return an unknown error: {}'.format(r.text))
|
||||
|
||||
def put(self, path, data):
|
||||
r = requests.put(
|
||||
'{}/{}'.format(self.url, path),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue