fix(homeassistant): Ensure appended config files start on new line. (#8784)

**Description**
<!--
Please include a summary of the change and which issue is fixed. Please
also include relevant motivation and context. List any dependencies that
are required for this change.
-->
⚒️ Fixes  # <!--(issue)-->

**⚙️ Type of change**

- [ ] ⚙️ Feature/App addition
- [x] 🪛 Bugfix
- [ ] ⚠️ Breaking change (fix or feature that would cause existing
functionality to not work as expected)
- [ ] 🔃 Refactor of current code

**🧪 How Has This Been Tested?**
<!--
Please describe the tests that you ran to verify your changes. Provide
instructions so we can reproduce. Please also list any relevant details
for your test configuration
-->
Used this as fix on my home-assistant chart.
Here's the initial problem:
```sh
$ cat recorder.txt
  recorder:
    purge_keep_days: 30
    commit_interval: 3
    db_url: xyz

$ cat config.yaml
  test: 123
  nest:
    x: 1
    y: 2

$ cat recorder.txt >> config.yaml
$ cat config.yaml
  test: 123
  nest:
    x: 1
    y: 2recorder:
    purge_keep_days: 30
    commit_interval: 3
    db_url: xyz
```

**📃 Notes:**
<!-- Please enter any other relevant information here -->

**✔️ Checklist:**

- [x] ⚖️ My code follows the style guidelines of this project
- [x] 👀 I have performed a self-review of my own code
- [ ] #️⃣ I have commented my code, particularly in hard-to-understand
areas
- [ ] 📄 I have made corresponding changes to the documentation
- [x] ⚠️ My changes generate no new warnings
- [ ] 🧪 I have added tests to this description that prove my fix is
effective or that my feature works
- [ ] ⬆️ I increased versions for any altered app according to semantic
versioning

** App addition**

If this PR is an app addition please make sure you have done the
following.

- [ ] 🪞 I have opened a PR on
[truecharts/containers](https://github.com/truecharts/containers) adding
the container to TrueCharts mirror repo.
- [ ] 🖼️ I have added an icon in the Chart's root directory called
`icon.png`

---

_Please don't blindly check all the boxes. Read them and only check
those that apply.
Those checkboxes are there for the reviewer to see what is this all
about and
the status of this PR with a quick glance._

Signed-off-by: Daniel Riedl <107212962+danriedl@users.noreply.github.com>
Signed-off-by: Stavros Kois <47820033+stavros-k@users.noreply.github.com>
Co-authored-by: Stavros Kois <47820033+stavros-k@users.noreply.github.com>
This commit is contained in:
Daniel Riedl
2023-05-06 20:51:13 +02:00
committed by GitHub
parent 1ca27fa45e
commit b97f780179
2 changed files with 3 additions and 1 deletions

View File

@@ -23,7 +23,7 @@ sources:
- https://github.com/home-assistant/home-assistant
- https://github.com/cdr/code-server
type: application
version: 19.0.15
version: 19.0.16
annotations:
truecharts.org/catagories: |
- home-automation

View File

@@ -59,11 +59,13 @@ configmap:
if grep -q recorder: "$config_file"; then
echo "configuration.yaml already contains recorder"
else
echo "" >> "$config_file"
cat /config/init/recorder.default >> "$config_file"
fi
if grep -q http: "$config_file"; then
echo "configuration.yaml already contains http section"
else
echo "" >> "$config_file"
cat /config/init/http.default >> "$config_file"
fi
else