Bug 265177 - net/cloud-init: fails when attempting to use write_files
Summary: net/cloud-init: fails when attempting to use write_files
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: amd64 Any
: --- Affects Only Me
Assignee: freebsd-ports-bugs (Nobody)
URL:
Keywords: needs-qa, patch
Depends on: 265975
Blocks:
  Show dependency treegraph
 
Reported: 2022-07-12 17:34 UTC by ewan.nisbet
Modified: 2023-05-20 13:14 UTC (History)
3 users (show)

See Also:
bugzilla: maintainer-feedback? (andrey)


Attachments
reformat makepatch for current port (412 bytes, text/plain)
2022-07-12 21:50 UTC, Andrey Fesenko
andrey: maintainer-approval-
Details

Note You need to log in before you can comment on or make changes to this bug.
Description ewan.nisbet 2022-07-12 17:34:44 UTC
hi,

I've been using py38-cloud-init, and now py39-cloud-init in conjunction with Xen Orchestra:

https://xen-orchestra.com/docs/installation.html#xoa
https://xoa.io/deploy

Originally with py38-cloud-init, and now py39-cloud-init, I'm applying the following change:

sed -i '' -e 's/            gid = grp.getgrnam(group).gr_gid/            pass #20220224 this comment added in packer builder. bug?: gid = grp.getgrnam(group).gr_gid/g' /usr/local/lib/python3.9/site-packages/cloudinit/util.py


Unless I make that change, a corresponding cloud_init with eg:

write_files:
- content: |
   some-script-here
  path: /root/some-script.sh

or

write_files:
- content: |
   some-script-here
  permissions: 0744
  path: /root/some-script.sh

write_files:
- content: |
   some-script-here
  permissions: "0744"
  path: /root/some-script.sh

doesn't appear to be handled correctly. Example error message: from /var/log/cloud-init-output.log is:

util.py[WARNING]: Running module write-files (<module 'cloudinit.config.cc_write_files' from '/usr/local/lib/python3.9/site-packages/cloudinit/config/cc_write_files.py'>) failed

I am successfully using cloud-init with the same xen/xen-orchestra & other operating systems, for example alma linux, without needing to apply this change. 

Please let me know if there is further information I can provide. Alternatively, also let me know if you believe this issue should be submitted upstream with cloud-init team directly.

Many thanks
Comment 1 ewan.nisbet 2022-07-12 17:46:18 UTC
> I've been using py38-cloud-init, and now py39-cloud-init in conjunction with Xen Orchestra

Perhaps to clarify: This means the hypervisor host is xen with cloud-init provided via xen orchestra, but the issue I'm reporting occurs in a FreeBSD13 vm on that platform.
Comment 2 Andrey Fesenko 2022-07-12 21:40:19 UTC
Confirm, i'm see this error message in log, my host system FreeBSD bhyve cloud-init. But file created in guest system.

We have 2 way, add patch in port, and need report upstream, #cloud-init IRC channel on Libera or https://bugs.launchpad.net/cloud-init/+filebug
Comment 3 Andrey Fesenko 2022-07-12 21:50:56 UTC
Created attachment 235227 [details]
reformat makepatch for current port
Comment 4 Andrey Fesenko 2022-07-12 22:23:39 UTC
In irc

cloud-init have hardcoded root:root https://github.com/canonical/cloud-init/blob/e0416cd67b423b9ae28e5edcd0db7aecdde4ecbe/cloudinit/config/cc_write_files.py#L18

need set owner: root:wheel in write_files
Comment 5 Andrey Fesenko 2022-07-12 22:41:02 UTC
upstream pull request https://github.com/canonical/cloud-init/pull/1587
Comment 6 Andrey Fesenko 2022-07-13 10:01:40 UTC
Comment on attachment 235227 [details]
reformat makepatch for current port

this wrong way, upstream have more complex patch. Testing
Comment 7 Mina Galić freebsd_triage 2023-05-20 13:14:28 UTC
this was fixed upstream and released in 22.3