feat: support atlantis dispatch new style auth

This commit is contained in:
2024-02-20 01:06:28 +01:00
parent 64403c82bc
commit e3f320b1ba

View File

@@ -49,6 +49,7 @@ if __name__ == "__main__":
if os.path.isfile(args.dispatcher_pass_file) or os.path.islink(args.dispatcher_pass_file): if os.path.isfile(args.dispatcher_pass_file) or os.path.islink(args.dispatcher_pass_file):
with open(args.dispatcher_pass_file) as f: with open(args.dispatcher_pass_file) as f:
user, password = f.read().split() user, password = f.read().split()
access_token = password # new style auth
# build message # # build message #
serviceName = args.service_name serviceName = args.service_name
@@ -64,7 +65,7 @@ if __name__ == "__main__":
url = base_url + "/send-all-icinga" url = base_url + "/send-all-icinga"
requests.post(url, json=vars(args)) requests.post(url, json=vars(args))
else: else:
url = base_url + "/smart-send" url = base_url + "/smart-send?dispatch-access-token={}".format(access_token)
struct = { struct = {
"users" : args.owners, "users" : args.owners,
"groups" : args.owner_groups, "groups" : args.owner_groups,