zalf-rdm / geonode-k8s

A Kubernetes helm chart for the geospacial webapplication Geonode
https://geonode-k8s.readthedocs.io/en/latest/
GNU General Public License v2.0
13 stars 9 forks source link

Bug: tasks_post_script does not work correctly #214

Closed AlexGacon closed 4 weeks ago

AlexGacon commented 1 month ago

Bug Description

When defining the following task_post_script code in the values file of our deployment, we have an error message 'Error: YAML parse error on geonode-k8s/templates/geonode/geonode-tasks-py-conf.yaml: error converting YAML to JSON: yaml: line 438: could not find expected ':''.

  tasks_post_script: |
    ctx.run("rm -rf /tmp/egis_oauth.json", pty=True)
    print("Generate OAuth configuration ...")
    oauth_client_id = os.environ["C2C_OAUTH_CLIENT_ID"]
    oauth_secret = os.environ["C2C_OAUTH_SECRET"]
    default_fixture = [
        {
              "model":"socialaccount.socialapp",
              "pk":12,
              "fields":{
                  "id":"12",
                  "provider":"microsoft",
                  "name":"C2C Authentification",
                  "client_id":oauth_client_id,
                  "secret":oauth_secret
              }
        },
        {
              "model":"socialaccount.socialapp_sites",
              "pk":12,
              "fields":{
                  "id":1,
                  "socialapp_id":1,
                  "site_id":1
              }
        }
    ]
    with open("/tmp/egis_oauth.json", "w") as fixturefile:
        json.dump(default_fixture, fixturefile)
    ctx.run(
        f"python manage.py loaddata /tmp/egis_oauth.json \
          --settings={_localsettings()}",
        pty=True,
    )

Reproduction Steps

Run a helm template with a values.yaml containing the above code.

Behavior

No error should be raised.

Additional Information

Any additional information or context that may be helpful in resolving the bug.

AlexGacon commented 1 month ago

We already have a bugfix on our fork, I will create a PR soon.

mwallschlaeger commented 4 weeks ago

close with PR #215