canonical/microcloud

Support environment variable for preseed

hayone1 opened this issue · 2 comments

The ask is simple.
Environment variables increase the ease and option of automation by a lot.

You could read stdin first and if it's nil or empty then read the environment variable next.

cat preseed.yml | microcloud init --preseed

and

export PRESEED=$(cat preseed.yml)
microcloud init --preseed

Hi @hayone1, can you please elaborate more on your specific automation use case? Why can't you pass the preseed file via stdin?

Well, more options allow for more choices and where certain environments are limited in the use of stdin, they can defer to environment variables.

eg. I tried to debug main_init_preseed in vscode, but vscode debug cannot read from stdin.
When using ansible also, I'd prefer to set the pressed content as an environment variable because it makes things more.
And this is just me.

As potential adoption of microcloud grows, you'd definitely find cases where the ability to set env variables would be the deciding factor in choosing microcloud over other options.