Ben Riggs wrote:
> Michael DeHaan wrote:
>   
>> Tom Brown wrote:
>>     
>>> Hi
>>>
>>> # rpm -qa | grep cobbler
>>> cobbler-1.0.3-1
>>>
>>> I was adding some boxes to cobbler with a script but had to kill it half 
>>> way through due to a box being added by mistake. I killed it but now 
>>> when i run a cobbler sync or try to restart cobbler i get this
>>>
>>> Starting cobbler daemon: Traceback (most recent call last):
>>>   File "/usr/bin/cobblerd", line 32, in ?
>>>     api = bootapi.BootAPI()
>>>   File "/usr/lib/python2.3/site-packages/cobbler/api.py", line 73, in 
>>> __init__
>>>     self.deserialize()
>>>   File "/usr/lib/python2.3/site-packages/cobbler/api.py", line 381, in 
>>> deserialize
>>>     return self._config.deserialize()
>>>   File "/usr/lib/python2.3/site-packages/cobbler/config.py", line 169, 
>>> in deserialize
>>>     if not serializer.deserialize(x,topological=True):
>>>   File "/usr/lib/python2.3/site-packages/cobbler/serializer.py", line 
>>> 88, in deserialize
>>>     rc = storage_module.deserialize(obj,topological)
>>>   File 
>>> "/usr/lib/python2.3/site-packages/cobbler/modules/serializer_yaml.py", 
>>> line 103, in deserialize
>>>     datastruct = yaml.load(data).next()  # first record
>>>   File "/usr/lib/python2.3/site-packages/cobbler/yaml/load.py", line 89, 
>>> in next
>>>     self.nestedDocs.nestToNextLine()
>>>   File "/usr/lib/python2.3/site-packages/cobbler/yaml/stream.py", line 
>>> 137, in nestToNextLine
>>>     indentation = indentLevel(line)
>>>   File "/usr/lib/python2.3/site-packages/cobbler/yaml/stream.py", line 
>>> 12, in indentLevel
>>>     while n < len(line) and line[n] == ' ':
>>> TypeError: len() of unsized object
>>>                                                            [FAILED]
>>>
>>> Anyone got any ideas how to clean this back up again?
>>>
>>> thanks
>>>
>>> _______________________________________________
>>> cobbler mailing list
>>> [email protected]
>>> https://fedorahosted.org/mailman/listinfo/cobbler
>>>   
>>>       
>> You will need to either fix or delete the offending config file in 
>> /var/lib/cobbler.
>>
>> This is generally a good reason to keep backups of the files in that 
>> directory.
>>
>> --Michael
>> _______________________________________________
>> cobbler mailing list
>> [email protected]
>> https://fedorahosted.org/mailman/listinfo/cobbler
>>     
>
> This issue is one we have run into a number of times as well. It arises 
> from the way the yaml module handles the files. Right now, we are just 
> careful to keep good backups (and to back the files up if we are going 
> to be making major changes), but a better solution is to either fix 
> cobbler/modules/serializer_yaml.py's interaction with the yaml module, 
> or switch to a different serializer.
>
> Ben
> _______________________________________________
> cobbler mailing list
> [email protected]
> https://fedorahosted.org/mailman/listinfo/cobbler
>   

Currently there is locking around access to this file using flock().

If you clobber writing a text file in the middle of writing a text file, 
I'm not sure how you would intend to solve that.

It is true we have alternative serializers (experimental!) available for 
those that want to use them. That all being said, I haven't heard this 
problem reported until this email, so I am not sure the problem is 
widespread. If it is, we definitely would want to look further.

One simple option we could do it have the serializer save the config of 
each object in seperate files in a directory structure... though I'd want
to do this with a modification to serializer_yaml such that we could 
automatically support new users w/o having an upgrade process.

i.e.

/var/lib/cobbler/config/distros/*
/var/lib/cobbler/config/profiles/*
/var/lib/cobbler/config/systems/*
/var/lib/cobbler/config/repos/*

Finding object names would be as simple as globbing the directories. 
Since cobbler would still load things into RAM, however, it would 
probably make things slower.

So, ultimately, I'm more in favor of just adding a crontab.weekly entry 
to do regular backups, coupled with some simple code to detect 
corruption and offer to restore the backup. Backups should be forceable 
with a command like "cobbler backup".

--Michael


_______________________________________________
cobbler mailing list
[email protected]
https://fedorahosted.org/mailman/listinfo/cobbler

Reply via email to