I'm trying to reproduced the script from here (in ...
# python
l
I'm trying to reproduced the script from here (in typescript) in python to create a digitalocean container registry credential
ContainerRegistryDockerCredentials
in python. https://github.com/pulumi/pulumi-kubernetesx/issues/49#issuecomment-651498775 My code look like that
Copy code
container_registry = ContainerRegistry.get("source", "hyperwave-research")
        registry_creds = pulumi.Output.secret( ContainerRegistryDockerCredentials(
            "container-registry-creds", registry_name=container_registry.name).docker_credentials)

        def encode_base64_dc(dc):
            message_bytes = dc.encode('ascii')
            base64_bytes = base64.b64encode(message_bytes)
            print(f"===> Docker  : {dc}")
            print(f"===> Docker Credential : {base64_bytes.decode('utf-8')}")
            return base64_bytes.decode("utf-8")

        dc = registry_creds.apply(encode_base64_dc)

        self.secret = Secret(
            "registry-creds-kube-secret",
            type="<http://kubernetes.io/dockerconfigjson|kubernetes.io/dockerconfigjson>",
            metadata={"namespace": "default", "name": f"registry-{do_registry_name}"},
            string_data={".dockerconfigjson": dc},
            opts=opts,
        )
However whatever I tried, the docker.credential is everytime None. I tried other property of the
ContainerRegistryDockerCredentials
and I can confirm I have value like registry_name
Copy code
```
      File "/home/dzucker/git/Hyperwave.Infrastructure/venv/lib/python3.8/site-packages/pulumi/runtime/rpc.py", line 192, in serialize_property
        obj[transformed_key] = await serialize_property(v, deps, input_transformer)
      File "/home/dzucker/git/Hyperwave.Infrastructure/venv/lib/python3.8/site-packages/pulumi/runtime/rpc.py", line 173, in serialize_property
        value = await serialize_property(output.future(), deps, input_transformer)
      File "/home/dzucker/git/Hyperwave.Infrastructure/venv/lib/python3.8/site-packages/pulumi/runtime/rpc.py", line 159, in serialize_property
        future_return = await asyncio.ensure_future(awaitable)
      File "/home/dzucker/git/Hyperwave.Infrastructure/venv/lib/python3.8/site-packages/pulumi/output.py", line 112, in get_value
        val = await self._future
      File "/home/dzucker/git/Hyperwave.Infrastructure/venv/lib/python3.8/site-packages/pulumi/output.py", line 174, in run
        transformed: Input[U] = func(value)
      File "./digitalocean/docker_registry.py", line 42, in print_dc
        message_bytes = dc.encode('ascii')
    AttributeError: 'NoneType' object has no attribute 'encode'
    error: an unhandled error occurred: Program exited with non-zero exit code: 1
I tried other idea that I found from the slack https://pulumi-community.slack.com/archives/C84L4E3N1/p1596457104392200?thread_ts=1596452646.389800&amp;cid=C84L4E3N1 however same result. Am I doing something ? or could it be they are a mapping error on the python property naming.