Append to existing dictionary in Cheetah-based template

219 Views Asked by At

I'm trying to add my own custom lines into the Cobbler snippet as Cheetah code. I can create a dictionary using #set, but how do I append to the same dictionary down the line?

...
#set partitions={
'root':{'name':'lv_root','mount':'/','size':8192},
'opt':{'name':'lv_opt','mount':'/opt','size':12288},
'tmp':{'name':'lv_tmp','mount':'/tmp','size':4096},
'var':{'name':'lv_var','mount':'/var','size':10240},
'home':{'name':'lv_home','mount':'/home','size':4096}
}
...

For example, later on in the snippet, I might have to add

'logs':{'name':'lv_logs','mount':'/logs','size':8192}
1

There are 1 best solutions below

1
On BEST ANSWER
#silent $partitions['logs'] = {'name':'lv_logs','mount':'/logs','size':8192}

#silent makes Cheetah to produce no output; without it the dictionary manipulations produces None as the output.