kapitan icon indicating copy to clipboard operation
kapitan copied to clipboard

Jsonnet doesn't remember file mode

Open pvanderlinden opened this issue 4 years ago • 4 comments

Describe the bug/feature When you render a file with the jinja2 input type, it remembers the file mode (e.g. executable). With the jsonnet input type this is not working.

To Reproduce Steps to reproduce the behavior:

  • Have a jsonnet input with the following main.jsonnet:
local kapitan = import 'lib/kapitan.libjsonnet';
{
  ["apply.sh"]: kapitan.jinja2_template(
    "template/apply.sh", 
    {})
}
  • make sure template/apply.sh exists and has executable flags (chmod +x template/apply.sh)
  • the output has no executable flag after compiling

Expected behavior the output file apply.sh should have the same file mode as the input template

pvanderlinden avatar May 07 '20 12:05 pvanderlinden

Hey, I would like to work on this issue. I am a first-time contributor. Can you suggest relevant resources to be studied for working on this issue?

sanyam1997 avatar Jun 17 '20 17:06 sanyam1997

Hey @sanyam1997 this particular issue requires a bit more thought as jsonnet per se does not allow doing this. An idea to solve this issue is to allow setting a new option in the inventory to set the mode file permissions for a particular pattern of files. I suggest you have a look at the inputs/base.py which already has basic support for this, but needs to be rethought.

ramaro avatar Jun 17 '20 22:06 ramaro

Hey @ramaro, I am new to open source and was looking for some guidance during the initial phase of open source contribution. Can you please email me at [email protected]?

sanyam1997 avatar Jun 17 '20 22:06 sanyam1997