Re: [Spacewalk-devel] [BUG][Patch] bugzilla reference 811646 update

2012-04-12 Thread Paul Robert Marino
Well if you think the channel map is tied to it you can test that
quickly by updating it.
I wrote a script which is available here
https://github.com/prmarino1/Extravehicular-Activity-Admin/blob/master/channel-managment/eva-dist-channel-map.pl
the documentation for it is embedded in pod format

or via you can update it via the the API as documented here
http://spacewalk.redhat.com/documentation/api/1.7/handlers/DistChannelHandler.html

also look at this ticket because they may give you some hints

https://bugzilla.redhat.com/show_bug.cgi?id=786705

if the dist channel map is a problem specifically comment 16 might be helpful

https://bugzilla.redhat.com/show_bug.cgi?id=786705#c16

although i haven't had time yet to test it my self.


On Thu, Apr 12, 2012 at 5:41 AM, James Hogarth  wrote:
> Hi all,
>
> This refers to this bug:
> https://bugzilla.redhat.com/show_bug.cgi?id=811646
>
> I've attached a patch to this bugzilla entry which begins the fix at
> least  it fixes the SQL exception raised where postgres encounters
> an 'unknown column' free_slots and then consequently whatever
> transaction you are in gets rolled back ...
>
> I'm getting a bit out of my depth now and starting to struggle a bit
> getting to the core issue though
>
> It would appear that a non-RHN (ie custom) channel does not appear in
> rhnDistChannelMap and consequently a SQL query to check the channel
> ends up null - or something like that
>
> I have no idea how that ends up as the symptom of 'if
> rhn-virtualization-host exists on the kvm host then cannot entitle a
> guest' though.
>
> Any ideas would be appreciated as I continue to dig through code
>
> James
>
> ___
> 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


Re: [Spacewalk-devel] bz 811990 proxy auth cache patch

2012-04-12 Thread Shannon Hughes

On 04/12/2012 11:00 AM, Miroslav Suchý wrote:

On 04/12/2012 03:26 PM, Shannon Hughes wrote:

Attaching a patch for review against proxy. Proxy continues to cache the
authentication token across requests that have different parsed
hostnames from the rhn proxy borker logic(ip vs canonical) for the
current proxy. This cache forces the spacewalk server to generate
incorrect kickstart files since it uses the proxy auth header to know
what hostname to replace in the generated kickstart file.

full details are in the spacewalk bug
https://bugzilla.redhat.com/show_bug.cgi?id=811990


Ah, I already answered in:
https://bugzilla.redhat.com/show_bug.cgi?id=811990#c1


what do you think about pulling the hostname out of the auth header and 
giving it its own http header for spacewalk server  to use? added a 
comment to bugzilla.


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


Re: [Spacewalk-devel] bz 811990 proxy auth cache patch

2012-04-12 Thread Miroslav Suchý

On 04/12/2012 03:26 PM, Shannon Hughes wrote:

Attaching a patch for review against proxy. Proxy continues to cache the
authentication token across requests that have different parsed
hostnames from the rhn proxy borker logic(ip vs canonical) for the
current proxy. This cache forces the spacewalk server to generate
incorrect kickstart files since it uses the proxy auth header to know
what hostname to replace in the generated kickstart file.

full details are in the spacewalk bug
https://bugzilla.redhat.com/show_bug.cgi?id=811990


Ah, I already answered in:
https://bugzilla.redhat.com/show_bug.cgi?id=811990#c1


--
Miroslav Suchy
Red Hat Satellite Engineering

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


Re: [Spacewalk-devel] Status of Debian support in Spacewalk

2012-04-12 Thread Miroslav Suchý

I have been approached by Debian developer Alexander
Wirt. And Bernd Zeimetz invited me to BSP in Salzburg:
 http://wiki.debian.org/BSP/2012/06/at/Salzburg
I hope that Alexander, Bernd and I will be able to get there Spacewalk 
packages into Debian.
If somebody is interested in Spacewalk and Debian I would be happy to 
see you in Salzburg in June.


P.S. To Steven and Eduardo - this does not mean that you should stop 
trying packaging Debian packages. We still need maintainer(s). In 
Salzburg we "just" may get packages to Debian.



--
Miroslav Suchy
Red Hat Satellite Engineering

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


[Spacewalk-devel] bz 811990 proxy auth cache patch

2012-04-12 Thread Shannon Hughes
Attaching a patch for review against proxy. Proxy continues to cache the 
authentication token across requests that have different parsed 
hostnames from the rhn proxy borker logic(ip vs canonical) for the 
current proxy. This cache forces the spacewalk server to generate 
incorrect kickstart files since it uses the proxy auth header to know 
what hostname to replace in the generated kickstart file.


full details are in the spacewalk bug 
https://bugzilla.redhat.com/show_bug.cgi?id=811990


Regards,

Shannon Hughes
Senior SEG/GSS
>From ba810fec2bb1c3e7700f7288290da845bee21454 Mon Sep 17 00:00:00 2001
From: Shannon Hughes 
Date: Thu, 12 Apr 2012 08:05:32 -0400
Subject: [PATCH] check proxy token for old host and refresh auth token if
 necessary

---
 proxy/proxy/rhnProxyAuth.py |3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/proxy/proxy/rhnProxyAuth.py b/proxy/proxy/rhnProxyAuth.py
index 85ba60e..72b3304 100644
--- a/proxy/proxy/rhnProxyAuth.py
+++ b/proxy/proxy/rhnProxyAuth.py
@@ -118,7 +118,8 @@ class ProxyAuth:
 log_debug(3)
 oldToken = self.get_cached_token()
 token = oldToken
-if not token or forceRefresh or self.__processSystemid():
+oldHost = string.split(oldToken, ':')[-1]
+if not token or forceRefresh or self.__processSystemid() or (oldHost != self.hostname):
 token = self.login()
 if token and token != oldToken:
 self.set_cached_token(token)
-- 
1.7.7.6

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

Re: [Spacewalk-devel] dto's from the database?

2012-04-12 Thread Tomas Lestach
On Thursday 12 of April 2012 11:32:05 Duncan Mac-Vicar P. wrote:

On 04/11/2012 11:00 AM, Tomas Lestach wrote: 
This is ok, because it's not used in the elaborator. Regards, 
Ok, here is a patch for review for the first part: adding a list of systems 
that need review, and showing a notification in the system detail that it needs 
reboot with a link to the action.

Screenshots:
http://imgur.com/z8Y9u
http://imgur.com/oLE4H

I am still missing something. In the query I am doing:

   AND EA.errata_id = E.id
   AND to_timestamp(S.last_boot) < SA.completion_time

This to_timestamp() only works (with those types) in Postgres. The problem is 
that both attributes have different types: numeric & timestamp in Postgres, 
numeric & date in oracle. But Oracle's to_timestamp takes a char. Any ideas 
how to make this query work across both? I hope a PL/SQL is not the the path 
:-/

Duncan




Hey Duncan,

I reviewed your patch and here're my comments:

- please rename one of the 
having_errata_with_keyword_applied_since_last_reboot query or mode - not to 
have the same name
  - even if it does not cause any troubles, it's better for later greps :-)

- requiresReboot method with its queries is unacceptable
  - I'm not sure, if you didn't understand what I already tried to explain, 
but you cannot run the whole 
having_errata_with_keyword_applied_since_last_reboot query accross all the 
registered systems and their errata, when you need and information about one 
single system - this is highly inefficient
Imagine you have 1 systems registered and tens of channels with hundreds 
of errata. You cannot join all these information to find out, whether one 
particular system needs a reboot

Otherwise the patch look good.


Regards,
Tomas
-- 
Tomas Lestach
RHN Satellite Engineering
___
Spacewalk-devel mailing list
Spacewalk-devel@redhat.com
https://www.redhat.com/mailman/listinfo/spacewalk-devel

Re: [Spacewalk-devel] [PATCH] Added systemd unit files

2012-04-12 Thread Jan Pazdziora
On Mon, Apr 02, 2012 at 06:42:40PM -0300, Pablo Hess wrote:
> Hello Folks,
> 
> In an effort to port Spacewalk's sysV init script to the
> all-new-and-shiny systemd, Marcelo Mello and I have created quite a few
> "unit files" (systemd speak for init script).
> 
> Due to service dependencies, we want to propose a new layout to make
> it compatible with the systemd approach.

[...]

> Current status
> 
> 
> Currently, the main spacewalk unit file (spacewalk.target) issues
> start/stop/restart/reload commands to all its dependencies. However,
> spacewalk-tomcat6.service is facing a few issues when stopping:

In the past, we've faced issues with tomcat when starting it -- the
service tomcat6 start would return even if the applications weren't
loaded yet, so any HTTP/ajp request would fail. See the lsof hack in
spacewalk-service. How is this issue addressed in the proposed systemd
approach?

-- 
Jan Pazdziora
Principal Software Engineer, Satellite Engineering, Red Hat

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


[Spacewalk-devel] [BUG][Patch] bugzilla reference 811646 update

2012-04-12 Thread James Hogarth
Hi all,

This refers to this bug:
https://bugzilla.redhat.com/show_bug.cgi?id=811646

I've attached a patch to this bugzilla entry which begins the fix at
least  it fixes the SQL exception raised where postgres encounters
an 'unknown column' free_slots and then consequently whatever
transaction you are in gets rolled back ...

I'm getting a bit out of my depth now and starting to struggle a bit
getting to the core issue though

It would appear that a non-RHN (ie custom) channel does not appear in
rhnDistChannelMap and consequently a SQL query to check the channel
ends up null - or something like that

I have no idea how that ends up as the symptom of 'if
rhn-virtualization-host exists on the kvm host then cannot entitle a
guest' though.

Any ideas would be appreciated as I continue to dig through code

James

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


Re: [Spacewalk-devel] dto's from the database?

2012-04-12 Thread Duncan Mac-Vicar P.

On 04/11/2012 11:00 AM, Tomas Lestach wrote:

This is ok, because it's not used in the elaborator. Regards,


Ok, here is a patch for review for the first part: adding a list of 
systems that need review, and showing a notification in the system 
detail that it needs reboot with a link to the action.


Screenshots:
http://imgur.com/z8Y9u
http://imgur.com/oLE4H

I am still missing something. In the query I am doing:

   AND EA.errata_id = E.id
   AND to_timestamp(S.last_boot) < SA.completion_time

This to_timestamp() only works (with those types) in Postgres. The 
problem is that both attributes have different types: numeric & 
timestamp in Postgres, numeric & date in oracle. But Oracle's 
to_timestamp takes a char. Any ideas how to make this query work across 
both? I hope a PL/SQL is not the the path :-/


Duncan



diff --git a/java/code/src/com/redhat/rhn/common/db/datasource/xml/System_queries.xml b/java/code/src/com/redhat/rhn/common/db/datasource/xml/System_queries.xml
index a6cbc2b..67673d0 100644
--- a/java/code/src/com/redhat/rhn/common/db/datasource/xml/System_queries.xml
+++ b/java/code/src/com/redhat/rhn/common/db/datasource/xml/System_queries.xml
@@ -757,6 +757,43 @@ ORDER BY  UPPER(COALESCE(S.NAME, '(none)')), S.ID
   
 
 
+
+SELECT S.id, S.NAME,
+   (SELECT 1
+  FROM rhnServerFeaturesView SFV
+ WHERE SFV.server_id = S.id
+   AND SFV.label = 'ftr_system_grouping') AS selectable
+  FROM rhnServerInfo SI,
+   rhnServer S,
+   rhnActionErrataUpdate EA,
+   rhnServerAction SA,
+   rhnErrata E
+ WHERE S.org_id = :org_id
+   AND EXISTS (SELECT 1 FROM rhnUserServerPerms USP WHERE USP.user_id = :user_id AND USP.server_id = S.id)
+   AND SI.server_id = S.id
+   AND S.id = SA.server_id
+   AND SA.action_id = EA.action_id
+   AND EA.errata_id = E.id
+   AND to_timestamp(S.last_boot) < SA.completion_time
+   AND E.id IN (SELECT EK.errata_id FROM rhnErrataKeyword EK WHERE EK.keyword = :keyword)
+   ORDER BY SI.checkin DESC
+
+
+
+  
+  
+  
+  
+  
+
+
+
+   
+   
+ SELECT 1 FROM rhnServer S WHERE S.id IN (%s) AND S.id=:sid
+   
+
+
 
   
 SELECT S.id, S.NAME,
diff --git a/java/code/src/com/redhat/rhn/frontend/action/systems/sdc/SystemOverviewAction.java b/java/code/src/com/redhat/rhn/frontend/action/systems/sdc/SystemOverviewAction.java
index 8b22bc0..c28c921 100644
--- a/java/code/src/com/redhat/rhn/frontend/action/systems/sdc/SystemOverviewAction.java
+++ b/java/code/src/com/redhat/rhn/frontend/action/systems/sdc/SystemOverviewAction.java
@@ -59,6 +59,7 @@ public class SystemOverviewAction extends RhnAction {
.RECEIVE_NOTIFICATIONS};
 
 /** {@inheritDoc} */
+@Override
 public ActionForward execute(ActionMapping mapping, ActionForm form,
 HttpServletRequest request, HttpServletResponse response) {
 RequestContext rctx = new RequestContext(request);
@@ -106,6 +107,9 @@ public class SystemOverviewAction extends RhnAction {
 boolean hasUpdates =
 criticalErrataCount + nonCriticalErrataCount + upgradablePackagesCount > 0;
 
+// Reboot needed after certain types of updates
+boolean rebootRequired = SystemManager.requiresReboot(user, sid);
+
 // Monitoring
 processRequestForMonitoring(user, s, request);
 
@@ -118,6 +122,7 @@ public class SystemOverviewAction extends RhnAction {
 
 SdcHelper.ssmCheck(request, sid, user);
 
+request.setAttribute("rebootRequired", Boolean.valueOf(rebootRequired));
 request.setAttribute("unentitled", Boolean.valueOf(s.getEntitlements().isEmpty()));
 request.setAttribute("systemInactive", Boolean.valueOf(s.isInactive()));
 request.setAttribute("documentation", ConfigDefaults.get().isDocAvailable());
diff --git a/java/code/src/com/redhat/rhn/frontend/strings/jsp/StringResource_en_US.xml b/java/code/src/com/redhat/rhn/frontend/strings/jsp/StringResource_en_US.xml
index 08db82c..d5f2977 100644
--- a/java/code/src/com/redhat/rhn/frontend/strings/jsp/StringResource_en_US.xml
+++ b/java/code/src/com/redhat/rhn/frontend/strings/jsp/StringResource_en_US.xml
@@ -5070,6 +5070,13 @@ value for this entitlement, excluding the default organization's consumption.
   
 
+  
+Systems requiring reboot
+
+  /rhn/systems/RequiringReboot
+  /rhn/systems/YourRhn.do
+
+  
 
   
 Inactive Systems
@@ -17558,6 +17565,13 @@ The Tree Path, Base Channel, and Installer Generation should always match. This
 	
 	 
 
+	 
+	The system requires a reboot
+		
+  /systems/details/Overview.do
+
+ 
+
 	 
 		System not checking in with @@PRODUCT_NAME@@
 		
diff --git a/java/code/src/com/redhat/rhn/frontend/strings/nav/StringResource_en_US.xml b/java/code/src/com/redhat/rhn/frontend/strings/nav/StringResource_en_US.xml
index c787d8c..6aec426 100644
--- a/