On Monday 16 of January 2012 02:19:39 Parsons, Aron wrote:
> I was making use of configchannel_import in spacecmd at work last week and
> noticed that the API seems to eat newlines at the end of a file; what you
> put in is not what you get out.  Some applications handle it fine, others
> not so well; sssd is an example of an application that pukes without a
> trailing newline.   It affects other API calls as well, such as the snippet
> ones.  However, those don't matter as much as the configuration files.
> 
> I debugged it a bit and it goes all the way down to the Redstone XML-RPC
> library trimming whitespace; XmlRpcParser.consumeCharData() calls trim() on
> the string. 

Hey Aron, that's correct.

For configuration files, where trailing newlines matter, we recommend to send 
base64 encoded file contents via configchannel.createOrUpdatePath API

...
string "contents" - Contents of the file (text or base64 encoded if binary). 
(ignored for directories)
boolean "contents_enc64" - Identifies base64 encoded content (default: 
disabled).
...

Maybe it might help you.

Regards,
-- 
Tomas Lestach
RHN Satellite Engineering, Red Hat


> Due to the access modifiers on some of the variables in the
> class, we can't just create subclass to override that method
> (consumeCharData() makes use of private variables).
> 
> Steve,
> Do you want to try and find a workaround or just call this out in the
> documentation for the configchannel_import function?  I don't want to say
> it makes configchannel_import worthless, but without a fix, I know I can't
> rely on it for the job it intends to do.
> 
> /aron
> 
> _______________________________________________
> Spacewalk-devel mailing list
> Spacewalk-devel@redhat.com
> https://www.redhat.com/mailman/listinfo/spacewalk-devel

_______________________________________________
Spacewalk-devel mailing list
Spacewalk-devel@redhat.com
https://www.redhat.com/mailman/listinfo/spacewalk-devel

Reply via email to