> Alex Davies wrote:
>> Hi All,
>>
>> Quick question/observation:
>>
>> [r...@prov snippets]# cobbler system dumpvars --name=svn | grep mac
>> 'mac_address': '00:0c:29:f3:0f:d8',
>> 'mac_address_eth0': '00:0c:29:f3:0f:d8',
>> ...
>>
>> Using this in a snippet, I would expect both to print the MAC address,
>> however only the interface level MAC works:
>>
>> #print $getVar('$mac_address', 'TESTing')
>> #print $getVar('$mac_address_eth0', 'TESTing')
>>
>> In fact, the output is as follows:
>>
>> #print Nothing
>> #print 00:0c:29:9d:8d:b9
>>
>> I'm running Cobbler 1.6.2 (Centos/5; EPEL RPM).
>>
>> While i'm quite sure there is a sensible reason for this, it seems
>> confusing that dumpvars does not provide a list of variables that can
>> be used in getVar. The excellent "Install VMWare kernel" snippet @
>> https://fedorahosted.org/cobbler/wiki/KickstartSnippets (Written by
>> Matt Hyclak) should also be updated to use _eth0 if this is intended
>> behaviour..
>>
>> Many thanks,
>>
>> ALex
>>
>
> The network config snippets show how to access MAC addresses and are
> what we use in /var/lib/cobbler/kickstarts/sample*.ks.
>
>
>>
>> ------------------------------------------------------------------------
>>
>> _______________________________________________
>> cobbler mailing list
>> [email protected]
>> https://fedorahosted.org/mailman/listinfo/cobbler
>>
>
> _______________________________________________
> cobbler mailing list
> [email protected]
> https://fedorahosted.org/mailman/listinfo/cobbler
>
I have noticed something similar to
> #print $getVar('$mac_address', 'TESTing')
>
> In fact, the output is as follows:
>
> #print Nothing
I have a partition setup script that uses $hostname if set or VolGroup00
if not. For some reason, the $getVar is not setting the default value (in
the above example TESTing) when the var is not found ($mac_address)
My script is as follows and will always fail if I do not set hostname when
setting up a system.
#set $hostname = $getVar('$hostname', None)
#if $hostname == None
#set $vgname = "VolGroup00"
#else
#set $hostpart = $hostname.split('.')[0]
#set $vgname = $hostpart
#end if
the #if check always fails causing the kickstart to fail, according to
cheetah docs this is valid:
To do a ``safe'' placeholder lookup that returns a default value if the
variable is missing:
$getVar('theVariable', None)
-Ron
_______________________________________________
cobbler mailing list
[email protected]
https://fedorahosted.org/mailman/listinfo/cobbler