sparse-intern-71089
02/23/2022, 1:42 PMworried-xylophone-86184
02/23/2022, 1:45 PMdef set_request_data_headers(args):
data = pulumi.Output.all(args.get("cluster_name"), args.get("cluster_url"),).apply(
lambda parameters: json.dumps(
{
"CLUSTER_NAME": parameters[0],
"CLUSTER_URL": parameters[1],
}
)
)
headers = {
"Authorization": args.get("token"),
}
return data, headers
register_cluster_with_argocd calls the above function
def register_cluster_with_argocd(args):
data, headers = set_request_data_headers(args)
pulumi.export("Data", data)
pulumi.export("Headers", headers)
response = <http://requests.post|requests.post>(
"SOME_URL",
headers=headers,
data=data,
)
return response
worried-xylophone-86184
02/23/2022, 1:48 PMFile "VIRTUAL_ENV_PATH/./aws/main.py", line 23, in create
response = argocd.register_cluster_with_argocd(argocd_registration_args)
File "VIRTUAL_ENV_PATH/./cluster_bootstrapping/argocd.py", line 34, in register_cluster_with_argocd
response = <http://requests.post|requests.post>(
File "VIRTUAL_ENV_PATH/venv/lib/python3.8/site-packages/requests/api.py", line 117, in post
return request('post', url, data=data, json=json, **kwargs)
File "VIRTUAL_ENV_PATH/venv/lib/python3.8/site-packages/requests/api.py", line 61, in request
return session.request(method=method, url=url, **kwargs)
File "VIRTUAL_ENV_PATH/venv/lib/python3.8/site-packages/requests/sessions.py", line 515, in request
prep = self.prepare_request(req)
File "VIRTUAL_ENV_PATH/venv/lib/python3.8/site-packages/requests/sessions.py", line 443, in prepare_request
p.prepare(
File "VIRTUAL_ENV_PATH/venv/lib/python3.8/site-packages/requests/models.py", line 321, in prepare
self.prepare_body(data, files, json)
File "VIRTUAL_ENV_PATH/venv/lib/python3.8/site-packages/requests/models.py", line 498, in prepare_body
self._body_position = body.tell()
TypeError: 'Output' object is not callable
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/home/sushantk/.pulumi/bin/pulumi-language-python-exec", line 107, in <module>
loop.run_until_complete(coro)
File "/usr/lib/python3.8/asyncio/base_events.py", line 616, in run_until_complete
return future.result()
File "VIRTUAL_ENV_PATH/venv/lib/python3.8/site-packages/pulumi/runtime/stack.py", line 110, in run_in_stack
await run_pulumi_func(lambda: Stack(func))
File "VIRTUAL_ENV_PATH/venv/lib/python3.8/site-packages/pulumi/runtime/stack.py", line 45, in run_pulumi_func
await wait_for_rpcs()
File "VIRTUAL_ENV_PATH/venv/lib/python3.8/site-packages/pulumi/runtime/stack.py", line 94, in wait_for_rpcs
raise exception
File "VIRTUAL_ENV_PATH/venv/lib/python3.8/site-packages/pulumi/output.py", line 182, in run
transformed: Input[U] = func(value)
File "VIRTUAL_ENV_PATH/venv/lib/python3.8/site-packages/pulumi/output.py", line 231, in lift
return UNKNOWN if isinstance(v, Unknown) else getattr(v, item)
AttributeError: 'str' object has no attribute 'tell'
error: an unhandled error occurred: Program exited with non-zero exit code: 1
worried-xylophone-86184
02/25/2022, 10:06 AMdef register_cluster_with_argocd(args, cluster):
response = pulumi_command.local.Command(
"command-testing",
create=("curl "
"-H 'Authorization: {ARGO_TOKEN}' "
"-H 'X-Argo-E2E: true' "
"-H 'Content-Type: application/json; charset=UTF-8' "
"-d '{{'ARGOCD_CLUSTER_NAME': {CLUSTER_NAME}, "
"'CLUSTER_NAME': {CLUSTER_NAME}, "
"SOME_URL_TO_REGISTER_ARGO_CD").format(
CLUSTER_NAME=args.get("cluster_name"),
CLOUD_PROVIDER=args.get("cloud_provider"),
ENV=args.get("env"),
REGION=args.get("region"),
ARGO_TOKEN=args.get("argo_token")),
opts=pulumi.ResourceOptions(depends_on=[cluster]),
)
return response
Attaching the recorded API in the thread. But even though I have the EKS Cluster added as a dependsOn
parameter its not populating the real value.worried-xylophone-86184
02/25/2022, 10:14 AMworried-xylophone-86184
02/25/2022, 10:15 AMworried-xylophone-86184
02/25/2022, 10:27 AMbillowy-army-68599
apply
@worried-xylophone-86184billowy-army-68599
pulumi.Output.all
inside your function, which isn't correctbillowy-army-68599
pulumi.Output.all
worried-xylophone-86184
03/02/2022, 10:38 AM