[ovirt-users] yaml cloud-init custom scripts
Nathanaël Blanchet
blanchet at abes.fr
Mon Jun 2 13:16:52 UTC 2014
Le 02/06/2014 14:38, Shahar Havivi a écrit :
> On 02.06.14 14:28, Nathanaël Blanchet wrote:
>> Le 02/06/2014 13:25, Shahar Havivi a écrit :
>>> On 02.06.14 13:07, Nathanaël Blanchet wrote:
>>>> Le 01/06/2014 20:00, Shahar Havivi a écrit :
>>>>> On 01.06.14 11:20, Omer Frenkel wrote:
>>>>>> ----- Original Message -----
>>>>>>> From: "Nathanaël Blanchet" <blanchet at abes.fr>
>>>>>>> To: "users" <users at ovirt.org>
>>>>>>> Sent: Friday, May 30, 2014 6:49:34 PM
>>>>>>> Subject: [ovirt-users] yaml cloud-init custom scripts
>>>>>>>
>>>>>>> Hello,
>>>>>>>
>>>>>>> I've been unsuccessfully trying to make work a custom yalm script with the
>>>>>>> cloud-init option in 3.4.1.
>>>>>>> All other native UI parameters are correctly configured (hostname...)
>>>>>>>
>>>>>>> My goal is to change the keyboard layout:
>>>>>>> write_files:
>>>>>>> - content: |
>>>>>>> # My new /etc/sysconfig/keyboard file
>>>>>>> KEYTABLE="fr"
>>>>>>> MODEL="pc105"
>>>>>>> LAYOUT="fr"
>>>>>>> KEYBOARDTYPE="pc"
>>>>>>> path: /etc/sysconfig/keyboard
>>>>>>> permissions: '0644'
>>>>>>>
>>>>>>> I can't see what is wrong and there is nothing into cloud-init logs on the
>>>>>>> guest (/var/log/clou-init-output.log).
>>>>>> isn't it in /var/log/cloud-init.log ?
>>>>>>
>>>>>>> Is it possible to see the whole yalm file generated by the engine somewhere?
>>>>>>>
>>>>>> the cloud init data is attached to the vm as a cd-rom
>>>>>> you can mount it locally and look inside the drive name is config-2 (look for it with blkid)
>>>>>> for me on fedora 19 it always appear in /dev/sr1
>>>>> First look at the mounted content as Omer suggested and take a look if the YAML
>>>>> output as you expected.
>>>>> You can also try to set the data that is written in the "custom script"
>>>>> commit:
>>>>> http://gerrit.ovirt.org/gitweb?p=ovirt-engine.git;a=commit;h=d46ebd8712f369b924e199b82197e59568a686ff
>>>>> see if adding this content is working for your setup:
>>>>> write_files:
>>>>> - content: |
>>>>> # some file content
>>>>> path: /root/myfile
>>>>>
>>>>> This sample was tested and worked under RHEL 6 and Fedora 19.
>>>>> Please note that you need to add a tab/4 spaces as shown above.
>>>>>
>>>>> What OS and what version of cloud-init you are using?
>>>> that's it, I finally managed to make it work after many an many tests, that
>>>> wasn't so trivial.
>>>> First I followed your advices and I successfully tested the sample script
>>>> you suggested without modify it. Then each time I attempted to add a line to
>>>> the same file, it wasn't executed anymore. I read the file with cat -T
>>>> /media/openstack/latest/user_data and then noticed that the lines weren't
>>>> uniformly formated : some were with tab and other ones with 8 spaces.
>>>> Following "Please note that you need to add a tab/4 spaces as shown above" I
>>>> added tab on every lines related to content of the file, but it didn't work.
>>>> I began again with only 8 spaces and then it ran.
>>>> Seems YAML to be very format sensitive and it is not clear enough when
>>>> begining this kind of job, so that I hope my leak will help many other ones.
>>>> I think the custom script field in the UI is not helpful because it is
>>>> impossible to insert a line, when doing a CR it leads to the end of file,
>>>> and it is a behaviour which easily leads to format error. It could be a good
>>>> idea to refuse validating OK if any tab is detected there.
>>>> Can I have your feeling about this?
>>> The problem was the CR at the end of the "custom script" field, or any CR?
>> any CR in the field leads to the end on the script
> So only when you copy/paste the custom script content it works for you?
Copy/past is the best way for not having tabs instead of the correct 8
spaces before each file content instruction
>>>>>>> --
>>>>>>> Nathanaël Blanchet
>>>>>>>
>>>>>>> Supervision réseau
>>>>>>> Pôle exploitation et maintenance
>>>>>>> Département des systèmes d'information
>>>>>>> 227 avenue Professeur-Jean-Louis-Viala
>>>>>>> 34193 MONTPELLIER CEDEX 5
>>>>>>> Tél. 33 (0)4 67 54 84 55
>>>>>>> Fax 33 (0)4 67 54 84 14 blanchet at abes.fr
>>>>>>>
>>>>>>> _______________________________________________
>>>>>>> Users mailing list
>>>>>>> Users at ovirt.org
>>>>>>> http://lists.ovirt.org/mailman/listinfo/users
>>>>>>>
>>>>>> _______________________________________________
>>>>>> Users mailing list
>>>>>> Users at ovirt.org
>>>>>> http://lists.ovirt.org/mailman/listinfo/users
>>>> --
>>>> Nathanaël Blanchet
>>>>
>>>> Supervision réseau
>>>> Pôle exploitation et maintenance
>>>> Département des systèmes d'information
>>>> 227 avenue Professeur-Jean-Louis-Viala
>>>> 34193 MONTPELLIER CEDEX 5
>>>> Tél. 33 (0)4 67 54 84 55
>>>> Fax 33 (0)4 67 54 84 14
>>>> blanchet at abes.fr
>>>>
>> --
>> Nathanaël Blanchet
>>
>> Supervision réseau
>> Pôle exploitation et maintenance
>> Département des systèmes d'information
>> 227 avenue Professeur-Jean-Louis-Viala
>> 34193 MONTPELLIER CEDEX 5
>> Tél. 33 (0)4 67 54 84 55
>> Fax 33 (0)4 67 54 84 14
>> blanchet at abes.fr
>>
--
Nathanaël Blanchet
Supervision réseau
Pôle exploitation et maintenance
Département des systèmes d'information
227 avenue Professeur-Jean-Louis-Viala
34193 MONTPELLIER CEDEX 5
Tél. 33 (0)4 67 54 84 55
Fax 33 (0)4 67 54 84 14
blanchet at abes.fr
More information about the Users
mailing list