All, attaching a patch to address the bug in $SUBJECT.
Regards, Shannon Hughes Senior SME/SEG
diff --git a/java/code/src/com/redhat/rhn/common/db/datasource/xml/config_queries.xml b/java/code/src/com/redhat/rhn/common/db/datasource/xml/config_queries.xml index edd8b1f..db053c1 100644 --- a/java/code/src/com/redhat/rhn/common/db/datasource/xml/config_queries.xml +++ b/java/code/src/com/redhat/rhn/common/db/datasource/xml/config_queries.xml @@ -1284,6 +1284,26 @@ ORDER BY CFN.path <elaborator name="file_name_elab" /> </mode> +<mode name="file_names_for_system_channel" class="com.redhat.rhn.frontend.dto.ConfigFileNameDto"> + <query params="sid, user_id"> +SELECT DISTINCT CFN.id, CFN.path + FROM rhnConfigFileName CFN, rhnServerConfigChannel SCC, + rhnConfigFile CF, rhnUserServerPerms USP, + rhnConfigChannel CC, rhnConfigChannelType CCT + WHERE SCC.server_id = :sid + AND CC.id = :ccid + AND USP.server_id = SCC.server_id + AND USP.user_id = :user_id + AND SCC.config_channel_id = CF.config_channel_id + AND SCC.config_channel_id = CC.id + AND CC.confchan_type_id = CCT.id + AND CCT.label != 'server_import' + AND CF.config_file_name_id = CFN.id +ORDER BY CFN.path + </query> + <elaborator name="file_name_elab" /> +</mode> + <mode name="file_names_in_set" class="com.redhat.rhn.frontend.dto.ConfigFileNameDto"> <query params="user_id, name_set_label"> SELECT CFN.id, CFN.path diff --git a/java/code/src/com/redhat/rhn/frontend/xmlrpc/configchannel/ConfigChannelHandler.java b/java/code/src/com/redhat/rhn/frontend/xmlrpc/configchannel/ConfigChannelHandler.java index 8c7f6e5..4be7f89 100644 --- a/java/code/src/com/redhat/rhn/frontend/xmlrpc/configchannel/ConfigChannelHandler.java +++ b/java/code/src/com/redhat/rhn/frontend/xmlrpc/configchannel/ConfigChannelHandler.java @@ -798,7 +798,7 @@ public class ConfigChannelHandler extends BaseHandler { } try { - manager.deployConfiguration(loggedInUser, servers, date); + manager.deployConfiguration(loggedInUser, servers, channel, date); } catch (MissingCapabilityException e) { throw new com.redhat.rhn.frontend.xmlrpc.MissingCapabilityException( diff --git a/java/code/src/com/redhat/rhn/manager/configuration/ConfigurationManager.java b/java/code/src/com/redhat/rhn/manager/configuration/ConfigurationManager.java index 90ccff3..2e8ebc8 100644 --- a/java/code/src/com/redhat/rhn/manager/configuration/ConfigurationManager.java +++ b/java/code/src/com/redhat/rhn/manager/configuration/ConfigurationManager.java @@ -536,6 +536,29 @@ public class ConfigurationManager extends BaseManager { } /** + * Lists the file names to which the given server is subscribed by channel + * Finds the deployable revisions for each file name. + * @param user The user requesting a list of file names + * @param server The server to which these files must be relevant + * @param channel The channel to which these files must be relevant + * @param pc A PageControl for this user + * @return A list of config file names in DTO format. + */ + public DataResult <ConfigFileNameDto> listFileNamesForSystemChannel(User user, Server server, + ConfigChannel channel, PageControl pc) { + SelectMode m = ModeFactory.getMode("config_queries", + "file_names_for_system_channel"); + Map params = new HashMap(); + params.put("user_id", user.getId()); + params.put("sid", server.getId()); + params.put("ccid", channel.getId()); + Map elabParams = new HashMap(); + elabParams.put("sid", server.getId()); + DataResult dr = makeDataResult(params, elabParams, pc, m); + return dr; + } + + /** * Lists the config channels in the user's config channel set to which the * given server is subscribed. Finds the deployable files for each channel. * @param user The user requesting a list of config channels @@ -2041,13 +2064,37 @@ public class ConfigurationManager extends BaseManager { public void deployConfiguration(User user, Collection <Server> servers, Date datePicked) { + deployConfiguration(user, servers, null, datePicked); + } + + + /** + * Schedules deploys of all the configuration files or dirs + * associated to a list of servers + * + * @param user User needed for authentication purposes.. + * @param servers The list of servers, to whom the deploy action + * needs to be scheduled + * @param channel ConfigChannel to deploy files from + * @param datePicked date to deploy or null for the earliest date + */ + public void deployConfiguration(User user, + Collection <Server> servers, + ConfigChannel channel, + Date datePicked) { if (datePicked == null) { datePicked = new Date(); } for (Server server : servers) { ensureConfigManageable(server); - List <ConfigFileNameDto> names = listFileNamesForSystem(user, - server, null); + + List <ConfigFileNameDto> names; + if(channel == null) { + names = listFileNamesForSystem(user, server, null); + } else { + names = listFileNamesForSystemChannel(user, server, channel, null); + } + Set <Server> system = new HashSet<Server>(); system.add(server); Set <Long> revs = new HashSet<Long>();
_______________________________________________ Spacewalk-devel mailing list Spacewalk-devel@redhat.com https://www.redhat.com/mailman/listinfo/spacewalk-devel