Patches are committed.  It looks like Tomas added the functionality you need to 
export base64 files, so feel free to submit patches to add that functionality 
when you have time.

/aron
________________________________________
From: Steven Hardy [[email protected]]
Sent: Monday, January 23, 2012 8:32 AM
To: Parsons, Aron
Cc: [email protected]
Subject: Re: API functions eat trailing whitespace (Redstone XML-RPC issue)

Hi Aron,

On Mon, 2012-01-16 at 02:19 +0000, 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.  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).

Apologies for the delay getting back to you with a fix for this:

I've just posted a patch which will base64 encode any file on
configchannel_import when trailing newlines are detected, which should
work around the issue you observed.

There is still the issue that there's no way to export file contents
base64 encoded via the API as far as I can tell.

This is not a problem with trailing newlines (these are exported as text
OK), but it is a problem if you have binary files, or files containing
characters not valid in XML (e.g the ascii escape character, which is a
problem for my particular usage).

I'm still looking for options to fix this, but it may not be possible
without a new API call which allows base64 encoded file contents to be
exported.

For now, I've posted another patch which detects when a file is exported
with no contents, and flags an error on import, so these files can be
manually fixed up (e.g with configchannel_addfile, which can now upload
binary/encoded files)


Steve


_______________________________________________
Spacewalk-devel mailing list
[email protected]
https://www.redhat.com/mailman/listinfo/spacewalk-devel

Reply via email to