Update image name once in multiple templates

Hi, while the issue #4787 is in a process of resolution.
Can anyone suggest an easy way to update the image name in multiple templates?

I tried to do it this way:

for i in 1 2 3 4 5; do
    onetemplate update $i <(EDITOR=cat onetemplate update $i | sed 's/IMAGE="Old_Image"/IMAGE="New_Image"/')
done

But it does not work, returned:

command update: argument 1 must be one of file,

Any ideas? Thanks!

Hi,

AFAIK updates are working with files. Please try using a temp file. Something like:

for i in 1 2 3 4 5; do
    tmpfile="$(mktemp)"
    EDITOR=cat onetemplate update $i | sed 's/IMAGE="Old_Image"/IMAGE="New_Image"/' >"$tmpfile"
    onetemplate update $i "$tmpfile"
    rm -f "$tmpfile"
done

Kind Regards,
Anton Todorov

Sure! Something I had not thought about a temporary file :slight_smile:

I think it’s possible to do it without using tempfiles. Can you try something like:

EDITOR="sed -i 's/IMAGE=\"Old_Image\"/IMAGE=\"New_Image\"/' $1" onetemplate update $i
1 Like

Hello @atodorov_storpool @kvaps ,
In addition to the above chain, how can I update the user-input value in instantiated VM.
I have assigned a default value for user-input while allocating, how to update the value on instantiation. Please suggest.