mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-04-25 11:51:26 -07:00
Fix deprecated warnings
This commit is contained in:
parent
3664c74cb8
commit
98fb47b061
5 changed files with 20 additions and 16 deletions
|
@ -249,11 +249,12 @@ after:
|
|||
"withCredentials": false }
|
||||
'''
|
||||
|
||||
import base64
|
||||
import json
|
||||
import os
|
||||
import base64
|
||||
|
||||
from ansible.module_utils.basic import AnsibleModule
|
||||
from ansible.module_utils.urls import fetch_url
|
||||
from ansible.module_utils._text import to_bytes
|
||||
|
||||
__metaclass__ = type
|
||||
|
||||
|
@ -362,7 +363,7 @@ def grafana_create_datasource(module, data):
|
|||
if 'grafana_api_key' in data and data['grafana_api_key'] is not None:
|
||||
headers['Authorization'] = "Bearer %s" % data['grafana_api_key']
|
||||
else:
|
||||
auth = base64.encodestring('%s:%s' % (data['grafana_user'], data['grafana_password'])).replace('\n', '')
|
||||
auth = base64.b64encode(to_bytes('%s:%s' % (data['grafana_user'], data['grafana_password'])).replace('\n', ''))
|
||||
headers['Authorization'] = 'Basic %s' % auth
|
||||
grafana_switch_organisation(module, data['grafana_url'], data['org_id'], headers)
|
||||
|
||||
|
@ -422,7 +423,7 @@ def grafana_delete_datasource(module, data):
|
|||
if 'grafana_api_key' in data and data['grafana_api_key']:
|
||||
headers['Authorization'] = "Bearer %s" % data['grafana_api_key']
|
||||
else:
|
||||
auth = base64.encodestring('%s:%s' % (data['grafana_user'], data['grafana_password'])).replace('\n', '')
|
||||
auth = base64.b64encode(to_bytes('%s:%s' % (data['grafana_user'], data['grafana_password'])).replace('\n', ''))
|
||||
headers['Authorization'] = 'Basic %s' % auth
|
||||
grafana_switch_organisation(module, data['grafana_url'], data['org_id'], headers)
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue