truecharts / public

Community Helm Chart Repository
https://truecharts.org
GNU Affero General Public License v3.0
1.14k stars 617 forks source link

home-Assistant fails to upgrade #6186

Closed Migsi closed 1 year ago

Migsi commented 1 year ago

App Name

home-assistant

SCALE Version

22.02.4

App Version

2022.12.8_18.0.24

Application Events

None

Application Logs

Error: Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/middlewared/job.py", line 411, in run
    await self.future
  File "/usr/lib/python3/dist-packages/middlewared/job.py", line 446, in __run_body
    rv = await self.method(*([self] + args))
  File "/usr/lib/python3/dist-packages/middlewared/schema.py", line 1272, in nf
    return await func(*args, **kwargs)
  File "/usr/lib/python3/dist-packages/middlewared/schema.py", line 1140, in nf
    res = await f(*args, **kwargs)
  File "/usr/lib/python3/dist-packages/middlewared/plugins/chart_releases_linux/upgrade.py", line 116, in upgrade
    await self.upgrade_chart_release(job, release, options)
  File "/usr/lib/python3/dist-packages/middlewared/plugins/chart_releases_linux/upgrade.py", line 299, in upgrade_chart_release
    await self.middleware.call('chart.release.helm_action', release_name, chart_path, config, 'upgrade')
  File "/usr/lib/python3/dist-packages/middlewared/main.py", line 1345, in call
    return await self._call(
  File "/usr/lib/python3/dist-packages/middlewared/main.py", line 1305, in _call
    return await self.run_in_executor(prepared_call.executor, methodobj, *prepared_call.args)
  File "/usr/lib/python3/dist-packages/middlewared/main.py", line 1206, in run_in_executor
    return await loop.run_in_executor(pool, functools.partial(method, *args, **kwargs))
  File "/usr/lib/python3.9/concurrent/futures/thread.py", line 52, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/usr/lib/python3/dist-packages/middlewared/plugins/chart_releases_linux/helm.py", line 44, in helm_action
    raise CallError(f'Failed to {tn_action} chart release: {stderr.decode()}')
middlewared.service_exception.CallError: [EFAULT] Failed to upgrade chart release: Error: UPGRADE FAILED: template: home-assistant/templates/common.yaml:5:3: executing "home-assistant/templates/common.yaml" at <include "tc.common.loader.apply" .>: error calling include: template: home-assistant/charts/common/templates/loader/_apply.tpl:20:5: executing "tc.common.loader.apply" at <include "tc.common.spawner.configmap" .>: error calling include: template: home-assistant/charts/common/templates/spawner/_configmap.tpl:16:10: executing "tc.common.spawner.configmap" at <include "tc.common.class.configmap" $>: error calling include: template: home-assistant/charts/common/templates/class/_configmap.tpl:33:6: executing "tc.common.class.configmap" at <tpl (toYaml .) $>: error calling tpl: error during tpl function execution for "configuration.yaml.default: |-\n  # Configure a default setup of Home Assistant (frontend, api, etc)\n  default_config:\n\n  # Text to speech\n  tts:\n    - platform: google_translate\n\n  group: !include groups.yaml\n  automation: !include automations.yaml\n  script: !include scripts.yaml\n  scene: !include scenes.yaml\nhttp.default: |2-\n\n  http:\n    use_x_forwarded_for: true\n    trusted_proxies:\n      {{- if hasKey .Values \"ixChartContext\" }}\n      - {{ .Values.ixChartContext.kubernetes_config.cluster_cidr }}\n      {{- else }}\n        {{- range .Values.homeassistant.trusted_proxies }}\n      - {{ . }}\n        {{- end }}\n      {{- end }}\ninit.sh: |-\n  #!/bin/sh\n  if test -f \"/config/configuration.yaml\"; then\n    echo \"configuration.yaml exists.\"\n    if grep -q recorder: \"/config/configuration.yaml\"; then\n    echo \"configuration.yaml already contains recorder\"\n    else\n    cat /config/init/recorder.default >> /config/configuration.yaml\n    fi\n    if grep -q http: \"/config/configuration.yaml\"; then\n    echo \"configuration.yaml already contains http section\"\n    else\n    cat /config/init/http.default >> /config/configuration.yaml\n    fi\n  else\n  echo \"configuration.yaml does NOT exist.\"\n  cp /config/init/configuration.yaml.default /config/configuration.yaml\n  cat /config/init/recorder.default >> /config/configuration.yaml\n  cat /config/init/http.default >> /config/configuration.yaml\n  fi\n\n  echo \"Creating include files...\"\n  for include_file in groups.yaml automations.yaml scripts.yaml scenes.yaml; do\n    if test -f \"/config/$include_file\"; then\n    echo \"$include_file exists.\"\n    else\n    echo \"$include_file does NOT exist.\"\n    touch \"/config/$include_file\"\n    fi\n  done\n\n  cd \"/config\" || echo \"Could not change path to /config\"\n  echo \"Creating custom_components directory...\"\n  mkdir \"/config/custom_components\" || echo \"custom_components directory already exists\"\n\n  echo \"Changing to the custom_components directory...\"\n  cd \"/config/custom_components\" || echo \"Could not change path to /config/custom_components\"\n\n  echo \"Downloading HACS\"\n  wget \"https://github.com/hacs/integration/releases/latest/download/hacs.zip\" || exit 0\n\n  if [ -d \"/config/custom_components/hacs\" ]; then\n      echo \"HACS directory already exist, cleaning up...\"\n      rm -R \"/config/custom_components/hacs\"\n  fi\n\n  echo \"Creating HACS directory...\"\n  mkdir \"/config/custom_components/hacs\"\n\n  echo \"Unpacking HACS...\"\n  unzip \"/config/custom_components/hacs.zip\" -d \"/config/custom_components/hacs\" >/dev/null 2>&1\n\n  echo \"Removing HACS zip file...\"\n  rm \"/config/custom_components/hacs.zip\"\n  echo \"Installation complete.\"\nrecorder.default: |2-\n\n  recorder:\n    purge_keep_days: 30\n    commit_interval: 3\n    db_url: {{ ( printf \"%s?client_encoding=utf8\" ( .Values.postgresql.url.complete | trimAll \"\\\"\" ) ) | quote }}": template: home-assistant/templates/common.yaml:19:18: executing "home-assistant/templates/common.yaml" at <.Values.ixChartContext.kubernetes_config.cluster_cidr>: nil pointer evaluating interface {}.cluster_cidr

Application Configuration

Pretty default, non relevant in regards to this bug. See additional context below.

Describe the bug

Upgrading the app isn't working anymore due to a nil exception happening while evaluating the apps/helm(?) values.yaml.

To Reproduce

Try to upgrade the app from any older version than mentioned above on TrueNAS-SCALE-22.02.4.

Expected Behavior

The app gets upgraded.

Screenshots

See additional context below.

Additional Context

I've quickly checked the repos, it seems the breaking change was introduced by https://github.com/truecharts/charts/pull/5846 where https://github.com/truecharts/charts/blob/fdcb7f69cbbdd9337787e02fe914beab8b89b683/charts/stable/home-assistant/values.yaml#L145 is the actual line that is failing. It seems that it is planned to migrate all apps to use dynamic cluster IP gathering, which in general sounds like a pretty good idea to me. This should be fixed though before performing this migration.

I've read and agree with the following

xstar97 commented 1 year ago

You are currently using TrueNAS Scale Angelfish(22.02.XX). we do NOT accept GH issues for older versions of the OS.

update to bluefin and then file a support ticket in our discord ->https://discord.gg/yFbMDwpfnW

Migsi commented 1 year ago

So you dropped support for Anglefish relatively silent in favor of Bluefin even though that was released just a month ago? Bold move. I had to google to get to the truecharts official news site, where I found an announcement. No mentions on the TrueNAS forum whatsoever. Don't get me wrong, dropping support is fine by me. I was just hoping for a "louder" announcement when such a move is performed. Also, please get rid of all Anglefish releases which are selectable when creating an issue here on Github. The current situation is very confusing.

PrivatePuffin commented 1 year ago

So you dropped support for Anglefish relatively silent in favor of Bluefin even though that was released just a month ago? Bold move. I had to google to get to the truecharts official news site, where I found an announcement. No mentions on the TrueNAS forum whatsoever. Don't get me wrong, dropping support is fine by me. I was just hoping for a "louder" announcement when such a move is performed. Also, please get rid of all Anglefish releases which are selectable when creating an issue here on Github. The current situation is very confusing.

Its on ALL our socials. Twitter, Discord, Telegram, Facebook and the website. Its been posted multiple times as well.

The TrueNAS forum is not one of our announcement channels and we also cannot easily add it as such to the workflow either.

PrivatePuffin commented 1 year ago

There are VERY important bugfixes in Bluefin. Not running it, is the bold move here ;-)

however, if you want to discuss this, discord it is (as always).