On 12/12/2011 07:15 PM, Marcelo Moreira de Mello wrote:
Hello team,

Follow attached 2 patches which introduces to rhncfg-manager a new
functionality to allow a file to be uploaded to Spacewalk server
overwriting the SELinux context at command line.

The second patch adds the option into the rhncfg-manager man page.

Best Regards,
Marcelo Moreira de Mello



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


This part:
+        selinux_ctx = None
+        if type(self.options.selinux_context) != None:
+            selinux_ctx = self.options.selinux_context
+        else:
+            selinux_ctx = ''

and

+        if type(selinux_ctx) == str:
+            params.update({
+                'selinux_ctx'   : selinux_ctx,
+            )}

means that you always override selinux context. Empty string is string as well.
If you remove that else branch, it will work.

And that
+if type(selinux_ctx) == str
is not good too.
You generaly never know if that string is str or unicode. So checking for type of string is better to be done like:

if isinstance(selinux_ctx, basestring):

but since isinstance is painfully slow, I would use in this case:

if selinux_ctx is not None:

The second patch seems ok.

Please fix the issue I mentioned and I would be happy to commit it.


--
Miroslav Suchy
Red Hat Satellite Engineering

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

Reply via email to