Bug 1309481
Summary: | Remote API is missing ability to retrieve and revert historic plug-in and resource configuration | ||
---|---|---|---|
Product: | [JBoss] JBoss Operations Network | Reporter: | Larry O'Leary <loleary> |
Component: | CLI | Assignee: | Josejulio Martínez <jmartine> |
Status: | CLOSED ERRATA | QA Contact: | Filip Brychta <fbrychta> |
Severity: | high | Docs Contact: | |
Priority: | high | ||
Version: | JON 3.3.5 | CC: | fbrychta, jmartine, mfoley, miburman, spinder |
Target Milestone: | DR01 | Keywords: | Triaged |
Target Release: | JON 3.3.6 | ||
Hardware: | Unspecified | ||
OS: | Unspecified | ||
Whiteboard: | |||
Fixed In Version: | Doc Type: | Bug Fix | |
Doc Text: | Story Points: | --- | |
Clone Of: | 1309480 | Environment: | |
Last Closed: | 2016-07-27 15:32:45 UTC | Type: | Bug |
Regression: | --- | Mount Type: | --- |
Documentation: | --- | CRM: | |
Verified Versions: | Category: | --- | |
oVirt Team: | --- | RHEL 7.3 requirements from Atomic Host: | |
Cloudforms Team: | --- | Target Upstream Version: | |
Embargoed: | |||
Bug Depends On: | 1309480 | ||
Bug Blocks: |
Description
Larry O'Leary
2016-02-17 23:00:18 UTC
commit 94e3588359b5d4d6fa4cb9b57c7c17b2a533b56f Author: Josejulio Mart\u00ednez <jmartine> Date: Mon Feb 22 19:16:48 2016 -0600 Bug 1309481 - Remote API is missing ability to retrieve and revert historic plug-in and resource configuration Exposed to remote API the following methods of ConfigurationManager. findPluginConfigurationUpdatesByCriteria findResourceConfigurationUpdatesByCriteria rollbackPluginConfiguration rollbackResourceConfiguration Exposed some methods of ConfigurationManager, also there already were some helpful methods: # Methods already exposed. ## Current plugin/resource configuration. - getPluginConfiguration - getResourceConfiguration ## Update plugin/resource configuration - updatePluginConfiguration - updateResourceConfiguration # Newly Exposed methods ## Find plugins/resource updates. - findPluginConfigurationUpdatesByCriteria - findResourceConfigurationUpdatesByCriteria ## Rollback plugin/resource to configuration - rollbackPluginConfiguration - rollbackResourceConfiguration #Sample usage var res_id = 10004; // Fetch current configuration. ConfigurationManager.getResourceConfiguration(res_id); // Fetch all configurations for resource. var criteria = new ResourceConfigurationUpdateCriteria(); criteria.addFilterResourceIds([new java.lang.Integer(res_id)]); criteria.fetchConfiguration(true); var config_updates = ConfigurationManager.findResourceConfigurationUpdatesByCriteria(criteria); // Newest configuration. config_updates.get(config_updates.size()); // Rollback to previous configuration (if any) if (config_updates.size() > 1) { ConfigurationManager.updateResourceConfiguration(res_id, config_updates.get(config_updates.size()-2).getConfiguration()); // or... // ConfigurationManager.rollbackResourceConfiguration(res_id, config_updates.get(config_updates.size()-2).getId()); } There is a mistake on the Sample usage, Instead of config_updates.get(config_updates.size()); Should be config_updates.get(config_updates.size()-1); This bug was accidentally moved from POST to MODIFIED via an error in automation, please see mmccune with any questions Moving to ON_QA as available to test with JON 3.3.6 DR01 brew build: https://brewweb.engineering.redhat.com/brew/buildinfo?buildID=499890 All added functions are working. Only problem I found is that it's not possible to get actual plugin configuration from PluginConfigurationUpdate. Following script will throw an exception: var criteria = new PluginConfigurationUpdateCriteria(); criteria.addFilterResourceIds([new java.lang.Integer(10002)]); criteria.fetchConfiguration(true); criteria.addSortCreatedTime(PageOrdering.ASC) var configUpdatesPre = ConfigurationManager.findPluginConfigurationUpdatesByCriteria(criteria); pretty.print(configUpdatesPre) var conf = configUpdatesPre.get(0).getConfiguration(); pretty.print(conf) Caused by: javax.ejb.EJBException: [Warning] org.hibernate.LazyInitializationException: could not initialize proxy - no Session at org.rhq.enterprise.server.remote.RemoteSafeInvocationHandler.invoke(RemoteSafeInvocationHandler.java:122) at org.jboss.remoting.ServerInvoker.invoke(ServerInvoker.java:967) at org.jboss.remoting.transport.servlet.ServletServerInvoker.processRequest(ServletServerInvoker.java:416) The exception is only visible when criteria.fetchConfiguration(true); is used and there already are some PluginConfigurationUpdates available. If you need to fetch the configuration from PluginConfigurationUpdates, you will also need to fetch the resource: criteria.fetchResource(true); It seems to be needed in order to correctly fetch the Configuration, ResourceConfigurationUpdates does fetch the Resource by default. It's working correctly with criteria.fetchResource(true); Since the problem described in this bug report should be resolved in a recent advisory, it has been closed with a resolution of ERRATA. For information on the advisory, and where to find the updated files, follow the link below. If the solution does not work for you, open a new bug report. https://rhn.redhat.com/errata/RHSA-2016-1519.html |