<div dir="ltr"><div class="gmail_extra"><br><div class="gmail_quote">On Thu, Oct 30, 2014 at 7:22 AM, Shahar Havivi <span dir="ltr"><<a href="mailto:shaharh@redhat.com" target="_blank">shaharh@redhat.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div class=""><div class="h5">On 29.10.14 17:35, Branimir Pejakovic wrote:<br>
> Hi list,<br>
><br>
> I was wondering is there a way to add multiple files to a vm via cloud-init<br>
> using python SDK. I was able to add /etc/resolv.conf and additionally I<br>
> would like to add config files for NICs (ifcfg-ethX) with appropriate<br>
> values (ip,gw,netmask). I used an example given here:<br>
> <a href="http://www.ovirt.org/Features/Cloud-Init_Integration" target="_blank">http://www.ovirt.org/Features/Cloud-Init_Integration</a> . But unfortunately I<br>
> cannot do the same thing If I want to write multiple files to a vm in<br>
> params.Action class.<br>
><br>
> Thank you in advance!<br>
</div></div>you can use the custom script text box in oVirts cloud-init section,<br>
there you can add any cloud-init section - adding files examples can be found<br>
here:<br>
<a href="http://cloudinit.readthedocs.org/en/latest/topics/examples.html#writing-out-arbitrary-files" target="_blank">http://cloudinit.readthedocs.org/en/latest/topics/examples.html#writing-out-arbitrary-files</a><br>
<br>
Shahar Havivi.<br>
<br></blockquote><div><br>Hi Shahar,<br><br></div><div>Thank you for the reply. <br><br>To
be honest I knew for those scripts but I want to do it in automate
fashion just like in that example that I put in my original message. I
have tried to specify in params.Files class multiple files:<br><br>vm_file1 = params.Files(file=[params.File(name = 'file1', content = file1_content, type_= 'PLAINTEXT')])<br>vm_file2 = params.Files(file=[params.File(name = 'file2', content = file2_content, type_= 'PLAINTEXT')])<br></div><br><div class="gmail_extra">and
then give them as arguments to params.CloudInit _init_ constructor
(files=...) just like in that example above but it seems that I am
doing something wrong because it does not write multiple files - it
writes only when you specify one file all right. The exception is
"Error: 'list' object has no attribute 'export'" (I tried to specify
those files as a list - files=[vm_file1,vm_file2]).<br><br></div><div class="gmail_extra">Thanks for any help.<br><br></div>Best regards,<br><br><br>Branimir</div><div class="gmail_signature"><div dir="ltr"><div><br></div></div></div>
</div></div>