[Spacewalk-devel] Fwd: ISE on SW 1.5 on user management

2011-12-12 Thread Pierre Casenove
Hi,
Please find attached a patch for SW 1.5 on postgresql addressing a ISE
on visibleSystems.java due to default cast to Integer on postgresql.

The ISE does not happen well logged in as Spacewalk administrator,
only with added users.

pierre


-- Forwarded message --
From: Pierre Casenove pcasen...@gmail.com
Date: 2011/12/9
Subject: Re: ISE on SW 1.5 on user management
To: spacewalk-l...@redhat.com


Me again.
After reading the PostGreSQLPortingGuide (should have done this
before), I found this:
https://fedorahosted.org/spacewalk/wiki/PostgreSQLPortingGuide#Defaultcasttointeger
I don't have my set up box available, but class
com.redhat.rhn.frontend.dto.VisibleSystems has to be modified. And by
comparing VisibleSystems class to SystemOverview class, here is what
should be modified to correct the error:
At line 78 , add this function:

           /**
            * For compatibility reasons with PostgreSQL we accept also Integer.
            *
            * @param selectableIn Whether a server is selectable one
if selectable,
            * null if not selectable
            */
           public void setSelectable(Integer selectableIn) {
               selectable = (selectableIn != null);
           }


I'm really sorry but I can't format a patch or what so ever, I have no
way to access the spacewalk server for the week end. And with 1.6
branching arriving on monday... I would like to have this patch
included.

Pierre


 2011/12/8 Pierre Casenove pcasen...@gmail.com:
 Just a quick update:
 running the query in psql shell works (I forgot the select * at the
 beggining). So the query is correct.
 From the error log, I guess that an Integer is returned in case the
 user is ldap-enabled, and a Long for a regular user.
 But I wasn't able to find the code behind this.

 Pierre

 2011/12/8 Pierre Casenove pcasen...@gmail.com:
 Hello List,
 I've plugged my SW 1.5 installation with PGSQL on a LDAP.
 When I create a user with PAM authentication, and then going to Users
 -- ldapUser -- Systems, I get an ISE.
 If I navigate to this page on a non ldap user, I don't get an ISE.
 I've attached the catalina.out logs.
 Two errors appears:
 First:
 ERROR com.redhat.rhn.common.db.datasource.CachedStatement - Error
 while processing cached statement sql: select * from (
  SELECT  DISTINCT S.id AS ID,
          S.name AS SERVER_NAME,
          (SELECT 1
          FROM rhnServerFeaturesView SFV
         WHERE SFV.server_id = S.id
           AND SFV.label = 'ftr_system_grouping') AS selectable
    FROM  rhnServer S, rhnUserServerPerms USP
   WHERE  USP.user_id = ?
     AND  S.id = USP.server_id
 ) X
 ORDER BY  UPPER(COALESCE(X.server_name, '(none)')), X.id

 -- When running it in psql, here is the output : ERROR:
 syntax error at or near )
 LINE 10: ) X


 Second error:
 Could not find method called: setSelectable in class:
 com.redhat.rhn.frontend.dto.VisibleSystems with params: [type:
 java.lang.Integer, value: 1]
 Indeed, looking at the source code, it is public void
 setSelectable(Long selectableIn)


 Could you please point me to some clue? I can't find in the source
 code where the query is built,  and I don't see what is erroneous in
 the query.

 Thanks,

 Pierre


Integer_Long_VisibleSystems.patch
Description: Binary data
___
Spacewalk-devel mailing list
Spacewalk-devel@redhat.com
https://www.redhat.com/mailman/listinfo/spacewalk-devel

Re: [Spacewalk-devel] [PATCHES] another patch set fixing PG SQL statements and other things

2011-12-12 Thread Michael Mraka
Michael Calmer wrote:
% Hi,
% 
% here is a list of small patches which fixes a lot of SQL statements for 
% postgres.
% 
% 0011-create-dir-if-it-does-not-exist.patch fixes a problem with not existing 
% directory at rhnpush.

Hi Michael,

I reviewed and commited your patches (with few minor formating changes).
 
% I found another small issue where I currently do not have a patch for. But I 
% want to let you know about it. If view the user list in the web ui with 
% spacewalk and postgres DB and you create a normal user (no roles assigned),
% the role column in the overview list is empty. With Oracle DB there is a text 
% (normal user) displayed.
% 
% The reason for this is a problem with the schema
% 
% common/views/rhnUsersInOrgOverview.sql has the line:
% 
%  select  coalesce(utcv.names, '(normal user)')
% 
% utcv.names is a column of view postgres/views/rhnUserTypeCommaView.sql which 
% has
% 
% array_to_string( array(select utb.type_name
%  from rhnUserTypeBase utb
%  where utb.user_id = C.id), ', ' )
% 
% array_to_string result in an empty string, but coalesce react only on NULL

I'd fix rhnUserTypeCommaView to return NULL for empty list. Maybe something
like this:

create or replace view rhnUserTypeCommaView
...
select id,
   case when type_id = '' then NULL else type_id end,
   ...
  from (
select
C.id,
array_to_string( array(select utb.type_id
   from rhnUserTypeBase utb
   where utb.user_id = C.id), ', ' ) as type_id,
...
from
web_contact as C
)

to avoid doing array_to_string() twice (and thus selecting twice from 
rhnUserTypeBase).


Regards,

--
Michael Mráka
Satellite Engineering, Red Hat

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

Re: [Spacewalk-devel] Fwd: ISE on SW 1.5 on user management

2011-12-12 Thread Tomas Lestach
On Monday 12 of December 2011 09:49:40 Pierre Casenove wrote:
 Hi,
 Please find attached a patch for SW 1.5 on postgresql addressing a ISE
 on visibleSystems.java due to default cast to Integer on postgresql.

Thank you, Pierre!
Applied as: d9e7e623ed4ddc7a667428b624c921e28a87bc27 to spacewalk master.

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


 
 The ISE does not happen well logged in as Spacewalk administrator,
 only with added users.
 
 pierre
 
 
 -- Forwarded message --
 From: Pierre Casenove pcasen...@gmail.com
 Date: 2011/12/9
 Subject: Re: ISE on SW 1.5 on user management
 To: spacewalk-l...@redhat.com
 
 
 Me again.
 After reading the PostGreSQLPortingGuide (should have done this
 before), I found this:
 https://fedorahosted.org/spacewalk/wiki/PostgreSQLPortingGuide#Defaultcastto
 integer I don't have my set up box available, but class
 com.redhat.rhn.frontend.dto.VisibleSystems has to be modified. And by
 comparing VisibleSystems class to SystemOverview class, here is what
 should be modified to correct the error:
 At line 78 , add this function:
 
/**
 * For compatibility reasons with PostgreSQL we accept also
 Integer. *
 * @param selectableIn Whether a server is selectable one
 if selectable,
 * null if not selectable
 */
public void setSelectable(Integer selectableIn) {
selectable = (selectableIn != null);
}
 
 
 I'm really sorry but I can't format a patch or what so ever, I have no
 way to access the spacewalk server for the week end. And with 1.6
 branching arriving on monday... I would like to have this patch
 included.
 
 Pierre
 
  2011/12/8 Pierre Casenove pcasen...@gmail.com:
  Just a quick update:
  running the query in psql shell works (I forgot the select * at the
  beggining). So the query is correct.
  From the error log, I guess that an Integer is returned in case the
  user is ldap-enabled, and a Long for a regular user.
  But I wasn't able to find the code behind this.
  
  Pierre
  
  2011/12/8 Pierre Casenove pcasen...@gmail.com:
  Hello List,
  I've plugged my SW 1.5 installation with PGSQL on a LDAP.
  When I create a user with PAM authentication, and then going to
  Users
  -- ldapUser -- Systems, I get an ISE.
  If I navigate to this page on a non ldap user, I don't get an ISE.
  I've attached the catalina.out logs.
  Two errors appears:
  First:
  ERROR com.redhat.rhn.common.db.datasource.CachedStatement - Error
  while processing cached statement sql: select * from (
   SELECT  DISTINCT S.id AS ID,
   S.name AS SERVER_NAME,
   (SELECT 1
   FROM rhnServerFeaturesView SFV
  WHERE SFV.server_id = S.id
AND SFV.label = 'ftr_system_grouping') AS selectable
 FROM  rhnServer S, rhnUserServerPerms USP
WHERE  USP.user_id = ?
  AND  S.id = USP.server_id
  ) X
  ORDER BY  UPPER(COALESCE(X.server_name, '(none)')), X.id
  
  -- When running it in psql, here is the output : ERROR:
  syntax error at or near )
  LINE 10: ) X
  
  
  Second error:
  Could not find method called: setSelectable in class:
  com.redhat.rhn.frontend.dto.VisibleSystems with params: [type:
  java.lang.Integer, value: 1]
  Indeed, looking at the source code, it is public void
  setSelectable(Long selectableIn)
  
  
  Could you please point me to some clue? I can't find in the source
  code where the query is built,  and I don't see what is erroneous in
  the query.
  
  Thanks,
  
  Pierre

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


Re: [Spacewalk-devel] Cobbler 2.2 support in 1.6

2011-12-12 Thread Miroslav Suchý

On 12/12/2011 12:58 AM, Parsons, Aron wrote:

I committed some patches for Cobbler 2.2 support tonight.  It'd be great if a 
few others could test to ensure I didn't break anything before 1.6 is released.


Thanks for the work.

But please next time try to check checkstyle (ant checkstyle). Otherwise 
it will not build:

http://koji.spacewalkproject.org/koji/getfile?taskID=86515name=build.log
I fixed those issues already.

--
Miroslav Suchy
Red Hat Satellite Engineering

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


[Spacewalk-devel] Branching of SW1.6 delayed

2011-12-12 Thread Martin Minar
Hello Spacewalkers,

I'm sorry to inform you that we are behind a schedule in branching of Spacewalk 
1.6 - we are processing a number of patches, implementing IPv6, trying to have 
SW1.6 running on F16... So branching will be delayed - hopefully not much.

Martin

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


[Spacewalk-devel] [PATCH] - BZ#765816 - Add an option into rhncfg-manager to allow file/directory to be uploaded without setting a SELinux context

2011-12-12 Thread Marcelo Moreira de Mello

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

--
Marcelo Moreira de Mello
RHCA RHCSS RHCVA
Senior Software Maintenance Engineer/SEG

gpg id: 2048R/FDB110E5
gpg fingerprint: 3BE7 EF71 4DD7 6812 D309  8F18 BD42 D095 FDB1 10E5

From: Marcelo Moreira de Mello mme...@redhat.com
Date: Mon, 12 Dec 2011 15:53:23 -0200
Subject: [PATCH 1/2] 765816 - Added the option --selinux-context to 
rhncfg-manager which
 allows to overwrite the SELinux context from a file

---
 .../tools/rhncfg/config_management/rhncfg_add.py   |   13 -
 .../rhncfg/config_management/rpc_repository.py |7 ++-
 2 files changed, 18 insertions(+), 2 deletions(-)

diff --git a/client/tools/rhncfg/config_management/rhncfg_add.py 
b/client/tools/rhncfg/config_management/rhncfg_add.py
index b88fbc1..ec68a86 100644
--- a/client/tools/rhncfg/config_management/rhncfg_add.py
+++ b/client/tools/rhncfg/config_management/rhncfg_add.py
@@ -48,6 +48,10 @@ class Handler(handler_base.HandlerBase):
 '-i', '--ignore-missing',   action=store_true,
  help=Ignore missing local files,
  ),
+handler_base.HandlerBase._option_class(
+'--selinux-context',   action=store_true,
+ help=Overwrite the SELinux context,
+ ),
 ]
 
 def run(self):
@@ -110,13 +114,20 @@ class Handler(handler_base.HandlerBase):
 
 delim_start = self.options.delim_start
 delim_end = self.options.delim_end
+
+selinux_ctx = None
+if type(self.options.selinux_context) != None:
+selinux_ctx = self.options.selinux_context
+else:
+selinux_ctx = ''
 
 for (local_file, remote_file) in files_to_push:
 try:
 r.put_file(channel, remote_file, local_file, 
 is_first_revision=self.is_first_revision,
 delim_start=delim_start,
-delim_end=delim_end)
+delim_end=delim_end,
+selinux_ctx=selinux_ctx)
 except cfg_exceptions.RepositoryFileExistsError, e:
 log_error(Error: %s is already in channel %s %
   (remote_file, channel))
diff --git a/client/tools/rhncfg/config_management/rpc_repository.py 
b/client/tools/rhncfg/config_management/rpc_repository.py
index 2206db1..907ff89 100644
--- a/client/tools/rhncfg/config_management/rpc_repository.py
+++ b/client/tools/rhncfg/config_management/rpc_repository.py
@@ -135,7 +135,7 @@ class Repository(repository.RPC_Repository):
 
 def put_file(self, config_channel, repopath, localfile=None, 
 is_first_revision=None, old_revision=None, delim_start=None, 
-delim_end=None):
+delim_end=None, selinux_ctx=None):
 
 Insert a given file into the repo, overwriting if necessary.
 localfile defaults to the repopath
@@ -151,6 +151,11 @@ class Repository(repository.RPC_Repository):
 error_msg = %s too large (%s bytes, %s bytes max allowed)  
 raise cfg_exceptions.ConfigFileTooLargeError(error_msg % 
(localfile, params['size'], max_file_size))
 
+if type(selinux_ctx) == str:
+params.update({
+'selinux_ctx'   : selinux_ctx,
+)}
+
 params.update({
 'session'   : self.session,
 'config_channel': config_channel,
-- 
1.7.7.4

From: Marcelo Moreira de Mello mme...@redhat.com
Date: Mon, 12 Dec 2011 16:05:26 -0200
Subject: [PATCH 2/2] 765816 - Added to the rhncfg-manager man page the option 
--selinux-context

---
 .../rhncfg/config_management/rhncfg-manager.sgml   |2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/client/tools/rhncfg/config_management/rhncfg-manager.sgml 
b/client/tools/rhncfg/config_management/rhncfg-manager.sgml
index 9b2a2e5..125ab21 100644
--- a/client/tools/rhncfg/config_management/rhncfg-manager.sgml
+++ b/client/tools/rhncfg/config_management/rhncfg-manager.sgml
@@ -96,6 +96,7 @@
 para-treplaceableTOPDIR/replaceable, 
--topdir=replaceableTOPDIR/replaceable -- make all files relative to this 
string/para
 para--delim-start=replaceableDELIM_START/replaceable -- 
start delimiter for variable interpolation/para
 para--delim-end=replaceableDELIM_END/replaceable -- end 
delimiter for variable interpolation/para
+para--selinux-context=replaceableSELINUX_CONTEXT/replaceable 
-- overwrite the SELinux context label to this string/para
 /listitem
 /varlistentry
 varlistentry
@@ -209,6 +210,7 @@
 para-treplaceableTOPDIR/replaceable, 

Re: [Spacewalk-devel] SysV to Systemd

2011-12-12 Thread Marcelo Moreira de Mello

On 12/06/2011 01:52 PM, Miroslav Suchy wrote:

FYI:
http://fedoraproject.org/wiki/Features/SysVtoSystemd
We will need to migrate from SysV init scripts to Systemd to support 
Fedora 17.
This is still 5 months ahead, but if somebody is boring, then you can 
grab this task. :)


Mirek

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

Hello Mirek,

  I'm working on this. I'll send a mail when it be ready.

 Best,
mmello

--
Marcelo Moreira de Mello
RHCA RHCSS RHCVA
Senior Software Maintenance Engineer/SEG

gpg id: 2048R/FDB110E5
gpg fingerprint: 3BE7 EF71 4DD7 6812 D309  8F18 BD42 D095 FDB1 10E5

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