Skip to content

Commit

Permalink
fix(config): relocate /run to /var/run on BSD (#4677)
Browse files Browse the repository at this point in the history
on BSD, /run is not ephemeral.
relocate BSDs config to /var/run

Sponsored by: The FreeBSD Foundation
Fixes GH-4180
Fixes GH-4231
Co-authored-by: Brett Holman <brett.holman@canonical.com>
  • Loading branch information
igalic committed Dec 15, 2023
1 parent d96f6e5 commit e2c4cdb
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
3 changes: 3 additions & 0 deletions config/cloud.cfg.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -326,6 +326,9 @@ system_info:
paths:
cloud_dir: /var/lib/cloud/
templates_dir: /etc/cloud/templates/
{% elif is_bsd %}
paths:
run_dir: /var/run/
{% endif %}
{% if variant == "debian" %}
package_mirrors:
Expand Down
9 changes: 5 additions & 4 deletions tests/unittests/test_ds_identify.py
Original file line number Diff line number Diff line change
Expand Up @@ -339,11 +339,16 @@ def write_mock(data):
]

uname = "Linux"
runpath = "run"
written = []
for d in mocks:
written.append(d["name"])
if d["name"] == "uname":
uname = d["out"].split(" ")[0]
# set runpath so that BSDs use /var/run rather than /run
if uname != "Linux":
runpath = "var/run"

for data in mocks:
mocklines.append(write_mock(data))
for d in default_mocks:
Expand All @@ -365,10 +370,6 @@ def write_mock(data):
out = e.stdout
err = e.stderr

runpath = "run"
if uname != "Linux":
runpath = "var/run"

cfg = None
cfg_out = os.path.join(rootd, runpath, "cloud-init/cloud.cfg")
if os.path.exists(cfg_out):
Expand Down

0 comments on commit e2c4cdb

Please sign in to comment.