public class ActionManager extends BaseManager
| Modifier and Type | Field and Description |
|---|---|
static java.lang.String[] |
PACKAGES_NOT_REMOVABLE |
| Modifier and Type | Method and Description |
|---|---|
static void |
addConfigurationRevisionsToAction(User user,
java.util.Collection<java.lang.Long> revisions,
ConfigAction configAction,
Server server)
Adds configuration revisions to a ConfigurationAction object
|
static void |
addPackageActionDetails(Action action,
java.util.List packages)
Adds package details to an Action
|
static void |
addServerToAction(java.lang.Long sid,
Action action)
Adds a server to an action
|
static void |
addServerToAction(Server server,
Action action)
Adds a server to an action
|
static DataResult |
allActions(User user,
PageControl pc)
Retrieve the list of all actions for a particular user.
|
static void |
archiveActions(User user,
java.lang.String label)
Archives the action set with the given label.
|
static DataResult |
archivedActions(User user,
PageControl pc)
Retrieve the list of completed actions for a particular user
|
static void |
cancelAction(User user,
Action action)
Cancels the server actions associated with a given action, and if
required deals with associated pending kickstart actions.
|
static void |
cancelActions(User user,
java.util.List actionsToCancel)
Cancels all actions in given list.
|
static void |
checkConfigActionOnServer(ActionType type,
Server server)
Checks that a server can be the target of a ConfigAction
|
static void |
checkScriptingOnServers(java.util.List<java.lang.Long> sids)
Checks that ScriptRunActions can be run on the servers with specified
IDs.
|
static DataResult |
completedActions(User user,
PageControl pc)
Retrieve the list of completed actions for a particular user
|
static DataResult |
completedSystems(User user,
Action action,
PageControl pc)
Retrieves the systems that have completed a given action
|
static Action |
createAction(User user,
ActionType type,
java.lang.String name,
java.util.Date earliestAction)
Creates, saves and returns a new Action
|
static Action |
createBaseAction(User user,
Server server,
ActionType type) |
static ConfigAction |
createConfigAction(User user,
ActionType type,
java.util.Date earliest)
Returns a new ConfigAction object
|
static Action |
createConfigAction(User user,
java.util.Collection<java.lang.Long> revisions,
java.util.Collection<java.lang.Long> serverIds,
ActionType type,
java.util.Date earliest)
Create a Config Action.
|
static Action |
createConfigActionForServers(User user,
java.util.Collection<java.lang.Long> revisions,
java.util.Collection<Server> servers,
ActionType type,
java.util.Date earliest)
Create a Config Action.
|
static Action |
createConfigDiffAction(User user,
java.util.Collection<java.lang.Long> revisions,
java.util.Collection<java.lang.Long> serverIds)
Create a Config File Diff action.
|
static Action |
createConfigUploadAction(User user,
java.util.Set filenames,
Server server,
ConfigChannel channel,
java.util.Date earliest)
Create a Config Upload action.
|
static Action |
createDeployImageAction(User user,
java.lang.String imageUrl,
java.lang.Long vcpus,
java.lang.Long memkb,
java.lang.String bridge,
ProxyConfig proxy)
Schedule deployment of an image to a vhost.
|
static ErrataAction |
createErrataAction(Org org,
Errata errata)
Creates an errata action with the specified Org
|
static Action |
createErrataAction(User user,
Errata errata)
Creates an errata action
|
static ScriptActionDetails |
createScript(java.lang.String username,
java.lang.String groupname,
java.lang.Long timeout,
java.lang.String script)
Creates a ScriptActionDetails which contains an arbitrary script to be
run by a ScriptRunAction.
|
static void |
deleteActions(User user,
java.lang.String label)
Deletes the action set with the given label.
|
static void |
deleteActionsById(User user,
java.util.List actionsIds)
Deletes the archived actions
|
static DataResult |
failedActions(User user,
PageControl pc)
Retrieve the list of failed actions for a particular user
|
static DataResult |
failedSystems(User user,
Action action,
PageControl pc)
Retrieves the systems that failed completing
a given action
|
static int |
failSystemAction(User loggedInUser,
java.lang.Long serverId,
java.lang.Long actionId,
java.lang.String message)
Mark action as failed for specified system
|
static java.lang.String |
getActionName(ActionType type)
Returns a name string from an Action type
|
static DataResult |
getConfigFileDeployList(java.lang.Long aid)
Returns the list of details associated with a config file deploy action.
|
static DataResult |
getConfigFileDiffList(java.lang.Long aid)
Returns the list of details associated with a config file diff action.
|
static DataResult |
getConfigFileUploadList(java.lang.Long aid)
Returns the list of details associated with a config file upload action.
|
static DataResult |
getErrataList(java.lang.Long aid)
Returns the list of errata associated with a specific action.
|
static DataResult |
getPackageList(java.lang.Long aid,
PageControl pc)
Returns the list of packages associated with a specific action.
|
static DataResult |
inProgressSystems(User user,
Action action,
PageControl pc)
Retrieves the systems that are in the process of completing
a given action
|
static Action |
lookupAction(User user,
java.lang.Long aid)
Retreive the specified Action, assuming that the User making the request
has the required permissions.
|
static Action |
lookupLastCompletedAction(User user,
ActionType type,
Server server)
Lookup the last completed Action on a Server
given the user, action type and server.
|
static DataResult |
pendingActions(User user,
PageControl pc)
Retrieve the list of pending actions for a particular user
|
static DataResult |
pendingActionsInSet(User user,
PageControl pc,
java.lang.String setLabel)
Retrieve the list of pending actions for a particular user within the given set.
|
static DataResult |
pendingActionsToDeleteInSet(User user,
PageControl pc,
java.lang.String setLabel,
java.lang.Long sid)
Retrieve the list of pending actions for a particular user within the given set.
|
static DataResult |
recentlyScheduledActions(User user,
PageControl pc,
long age)
Retrieve the list of unarchived scheduled actions for the
current user
|
static int |
removeActions(java.util.List actionIds)
Removes a list of actions.
|
static void |
rescheduleAction(Action action)
Reschedule the action so it can be attempted again.
|
static void |
rescheduleAction(Action action,
boolean onlyFailed)
Reschedule the action so it can be attempted again.
|
static void |
scheduleAllErrataUpdate(User scheduler,
Server srvr,
java.util.Date earliest)
Schedules all Errata for the given system.
|
static Action |
scheduleCertificateUpdate(User scheduler,
Server server,
java.util.Date earliestAction)
scheduleCertificateUpdate
|
static void |
scheduleForExecution(Action action,
java.util.Set<java.lang.Long> serverIds)
Schedules an action for execution on one or more servers (adding rows to
rhnServerAction)
|
static Action |
scheduleHardwareRefreshAction(User scheduler,
java.util.Date earliestAction,
java.util.Set<java.lang.Long> serverIds)
Schedule a scheduleHardwareRefreshAction against a system or systems
|
static Action |
scheduleHardwareRefreshAction(User scheduler,
Server srvr,
java.util.Date earliestAction)
Schedule a scheduleHardwareRefreshAction against a system
|
static KickstartAction |
scheduleKickstartAction(KickstartData ksdata,
User scheduler,
Server srvr,
java.util.Date earliestAction,
java.lang.String appendString,
java.lang.String kickstartHost)
Schedule a KickstartAction against a system
|
static KickstartAction |
scheduleKickstartAction(java.util.Set<FileList> fileList,
User scheduler,
Server srvr,
java.util.Date earliestAction,
java.lang.String appendString,
java.lang.String kickstartHost)
Schedule a KickstartAction against a system
|
static KickstartGuestAction |
scheduleKickstartGuestAction(ProvisionVirtualInstanceCommand pcmd,
java.lang.Long ksSessionId)
Schedule a KickstartGuestAction against a system
|
static Action |
schedulePackageAction(User scheduler,
java.util.List pkgs,
ActionType type,
java.util.Date earliestAction,
Server... servers)
Schedules a package action of the given type for the given server with the
packages given as a list.
|
static Action |
schedulePackageAction(User scheduler,
java.util.List pkgs,
ActionType type,
java.util.Date earliestAction,
java.util.Set<java.lang.Long> serverIds)
Schedules a package action of the given type for the given server with the
packages given as a list.
|
static PackageAction |
schedulePackageInstall(User scheduler,
Server srvr,
java.util.List pkgs,
java.util.Date earliestAction)
Schedules one or more package installation actions for the given server.
|
static Action |
schedulePackageInstall(User scheduler,
Server srvr,
java.lang.Long nameId,
java.lang.Long evrId,
java.lang.Long archId)
Schedules an install of a package
|
static PackageAction |
schedulePackageRefresh(User scheduler,
Server server)
Schedules a package list refresh action for the given server.
|
static PackageAction |
schedulePackageRefresh(User scheduler,
Server server,
java.util.Date earliest)
Schedules a package list refresh action for the given server.
|
static PackageAction |
schedulePackageRemoval(User scheduler,
Server srvr,
java.util.List<java.util.Map<java.lang.String,java.lang.Long>> pkgs,
java.util.Date earliestAction)
Schedules one or more package removal actions for the given server.
|
static PackageAction |
schedulePackageRemoval(User scheduler,
Server srvr,
RhnSet pkgs,
java.util.Date earliestAction)
Schedules one or more package removal actions for the given server.
|
static PackageAction |
schedulePackageRunTransaction(User scheduler,
Server server,
java.util.List pkgs,
java.util.Date earliest)
Schedules a package runtransaction action.
|
static PackageAction |
schedulePackageVerify(User scheduler,
Server srvr,
RhnSet pkgs,
java.util.Date earliest)
Schedules one or more package verification actions for the given server.
|
static Action |
scheduleReboot(User scheduler,
Server server,
java.util.Date earliestAction)
Schedule machine reboot.
|
static Action |
scheduleRebootAction(User scheduler,
Server srvr,
java.util.Date earliestAction)
Schedule a scheduleRebootAction against a system
|
static ScriptRunAction |
scheduleScriptRun(User scheduler,
java.util.List<java.lang.Long> sids,
java.lang.String name,
ScriptActionDetails script,
java.util.Date earliest)
Schedules a script action for the given servers
|
static ScapAction |
scheduleXccdfEval(User scheduler,
Server srvr,
java.lang.String path,
java.lang.String parameters,
java.util.Date earliestAction)
Schedules Xccdf evaluation.
|
static ScapAction |
scheduleXccdfEval(User scheduler,
java.util.Set<java.lang.Long> serverIds,
java.lang.String path,
java.lang.String parameters,
java.util.Date earliestAction)
Schedules Xccdf evaluation.
|
static Action |
storeAction(Action actionIn)
Stores the action in the database through hibernate
|
makeDataResult, makeDataResult, makeDataResult, makeDataResult, makeDataResultNoPagination, makeDataResultNoPagination, processListControl, processPageControlpublic static int removeActions(java.util.List actionIds)
actionIds - actions to removepublic static int failSystemAction(User loggedInUser, java.lang.Long serverId, java.lang.Long actionId, java.lang.String message)
loggedInUser - The user making the request.serverId - server idactionId - The id of the Action to be set as failedmessage - Message from user, reason of this failpublic static Action lookupAction(User user, java.lang.Long aid)
user - The user making the lookup request.aid - The id of the Action to lookup.LookupException - if the Action
can't be looked up.public static Action lookupLastCompletedAction(User user, ActionType type, Server server)
user - the user doing the search (needed for permssion checking)type - the action type of the action to be queried.server - the server who's latest completed action is desired.public static void deleteActions(User user, java.lang.String label)
user - User associated with the set of actions.label - Action label to be updated.public static void archiveActions(User user, java.lang.String label)
user - User associated with the set of actions.label - Action label to be updated.public static void cancelActions(User user, java.util.List actionsToCancel)
user - User associated with the set of actions.actionsToCancel - List of actions to be cancelled.public static void cancelAction(User user, Action action)
user - User requesting the action be cancelled.action - Action to be cancelled.public static void deleteActionsById(User user, java.util.List actionsIds)
user - User requesting the delete actionactionsIds - List of action ids to be deletedpublic static void addServerToAction(java.lang.Long sid,
Action action)
sid - The server idaction - The parent actionpublic static void addServerToAction(Server server, Action action)
server - The serveraction - The parent actionpublic static ErrataAction createErrataAction(Org org, Errata errata)
org - The org that needs the errata.errata - The errata pertaining to this actionpublic static Action createErrataAction(User user, Errata errata)
user - The user scheduling errataerrata - The errata pertaining to this actionpublic static Action createConfigUploadAction(User user, java.util.Set filenames, Server server, ConfigChannel channel, java.util.Date earliest)
user - The scheduler for this config action.filenames - A set of config file name ids as Longsserver - The server for which to schedule this action.channel - The config channel to which files will be uploaded.earliest - The soonest time that this action could be executed.public static Action createConfigDiffAction(User user, java.util.Collection<java.lang.Long> revisions, java.util.Collection<java.lang.Long> serverIds)
user - The user scheduling a diff action.revisions - A set of revision ids as LongsserverIds - A set of server ids as Longspublic static Action createConfigActionForServers(User user, java.util.Collection<java.lang.Long> revisions, java.util.Collection<Server> servers, ActionType type, java.util.Date earliest)
user - The user scheduling the action.revisions - A set of revision ids as Longsservers - A set of server objectstype - The type of config actionearliest - The earliest time this action could execute.public static void addConfigurationRevisionsToAction(User user, java.util.Collection<java.lang.Long> revisions, ConfigAction configAction, Server server)
user - the user scheduling the actionrevisions - a set of revision ids as LongsconfigAction - the action to add revisions toserver - a server objectpublic static void checkConfigActionOnServer(ActionType type, Server server)
type - type of ConfigActionserver - a server objectMissingCapabilityException - if server does not have needed capabilitiespublic static ConfigAction createConfigAction(User user, ActionType type, java.util.Date earliest)
user - the user scheduling the actiontype - type of ConfigActionearliest - earliest action scheduling datepublic static Action createConfigAction(User user, java.util.Collection<java.lang.Long> revisions, java.util.Collection<java.lang.Long> serverIds, ActionType type, java.util.Date earliest)
user - The user scheduling the action.revisions - A set of revision ids as LongsserverIds - A set of server ids as Longstype - The type of config actionearliest - The earliest time this action could execute.public static Action createDeployImageAction(User user, java.lang.String imageUrl, java.lang.Long vcpus, java.lang.Long memkb, java.lang.String bridge, ProxyConfig proxy)
user - The user scheduling image deploymentimageUrl - The URL of the image to be deployedvcpus - number of vcpusmemkb - memory in Kbbridge - deviceproxy - proxy configurationpublic static Action createBaseAction(User user, Server server, ActionType type)
user - The user scheduling the actionserver - The server the action is being scheduled fortype - The type of the actionpublic static Action storeAction(Action actionIn)
actionIn - The action to be storedpublic static void rescheduleAction(Action action)
action - Action to reschedulepublic static void rescheduleAction(Action action, boolean onlyFailed)
action - Action to rescheduleonlyFailed - reschedule only the ServerActions w/failed statuspublic static DataResult recentlyScheduledActions(User user, PageControl pc, long age)
user - The user in questionpc - The details of which results to returnage - how many days old a system can be in order to count as a "recently"
scheduled actionpublic static DataResult allActions(User user, PageControl pc)
user - The user in questionpc - The details of which results to returnpublic static DataResult pendingActions(User user, PageControl pc)
user - The user in questionpc - The details of which results to returnpublic static DataResult pendingActionsInSet(User user, PageControl pc, java.lang.String setLabel)
user - The user in questionpc - The details of which results to returnsetLabel - Label of an RhnSet of actions IDs to limit the results to.public static DataResult pendingActionsToDeleteInSet(User user, PageControl pc, java.lang.String setLabel, java.lang.Long sid)
user - The user in questionpc - The details of which results to returnsetLabel - Label of an RhnSet of actions IDs to limit the results to.sid - Server idpublic static DataResult failedActions(User user, PageControl pc)
user - The user in questionpc - The details of which results to returnpublic static DataResult completedActions(User user, PageControl pc)
user - The user in questionpc - The details of which results to returnpublic static DataResult archivedActions(User user, PageControl pc)
user - The user in questionpc - The details of which results to returnpublic static DataResult getPackageList(java.lang.Long aid, PageControl pc)
aid - The action id for the action in questionpc - The details of which results to returnpublic static DataResult getErrataList(java.lang.Long aid)
aid - The action id for the action in questionpublic static DataResult getConfigFileUploadList(java.lang.Long aid)
aid - The action id for the action in questionpublic static DataResult getConfigFileDeployList(java.lang.Long aid)
aid - The action id for the action in questionpublic static DataResult getConfigFileDiffList(java.lang.Long aid)
aid - The action id for the action in questionpublic static DataResult completedSystems(User user, Action action, PageControl pc)
user - The user in question.action - The Action.pc - The PageControl.public static DataResult inProgressSystems(User user, Action action, PageControl pc)
user - The user in question.action - The Action.pc - The PageControl.public static DataResult failedSystems(User user, Action action, PageControl pc)
user - The user in question.action - The Action.pc - The PageControl.public static PackageAction schedulePackageRefresh(User scheduler, Server server)
scheduler - User scheduling the action.server - Server for which the action affects.public static PackageAction schedulePackageRefresh(User scheduler, Server server, java.util.Date earliest)
scheduler - User scheduling the action.server - Server for which the action affects.earliest - The earliest time this action should be run.MissingEntitlementException - if the server is not entitledpublic static PackageAction schedulePackageRunTransaction(User scheduler, Server server, java.util.List pkgs, java.util.Date earliest)
scheduler - User scheduling the action.server - Server for which the action affects.pkgs - List of PackageMetadata's to be run.earliest - The earliest time this action should be run.public static PackageAction schedulePackageRemoval(User scheduler, Server srvr, RhnSet pkgs, java.util.Date earliestAction)
scheduler - User scheduling the action.srvr - Server for which the action affects.pkgs - The set of packages to be removed.earliestAction - Date of earliest action to be executedpublic static PackageAction schedulePackageRemoval(User scheduler, Server srvr, java.util.List<java.util.Map<java.lang.String,java.lang.Long>> pkgs, java.util.Date earliestAction)
scheduler - User scheduling the action.srvr - Server for which the action affects.pkgs - The list of packages to be removed.earliestAction - Date of earliest action to be executedpublic static PackageAction schedulePackageInstall(User scheduler, Server srvr, java.util.List pkgs, java.util.Date earliestAction)
scheduler - User scheduling the action.srvr - Server for which the action affects.pkgs - The set of packages to be removed.earliestAction - Date of earliest action to be executedpublic static PackageAction schedulePackageVerify(User scheduler, Server srvr, RhnSet pkgs, java.util.Date earliest)
scheduler - User scheduling the action.srvr - Server for which the action affects.pkgs - The set of packages to be removed.earliest - Earliest occurrence of the script.public static ScriptRunAction scheduleScriptRun(User scheduler, java.util.List<java.lang.Long> sids, java.lang.String name, ScriptActionDetails script, java.util.Date earliest)
scheduler - User scheduling the action.sids - Servers for which the action affects.script - The set of packages to be removed.name - Name of Script action.earliest - Earliest occurrence of the script.MissingCapabilityException - if any server in the list is missing script.run;
schedule failspublic static void checkScriptingOnServers(java.util.List<java.lang.Long> sids)
throws MissingCapabilityException
sids - servers' idsMissingCapabilityException - if scripts cannot be runMissingEntitlementException - if the server is not entitledpublic static ScriptActionDetails createScript(java.lang.String username, java.lang.String groupname, java.lang.Long timeout, java.lang.String script)
username - Username of scriptgroupname - Group script runs asscript - Script contentstimeout - script timeoutpublic static void scheduleForExecution(Action action, java.util.Set<java.lang.Long> serverIds)
action - the actionserverIds - server IDspublic static Action createAction(User user, ActionType type, java.lang.String name, java.util.Date earliestAction)
user - the user who created this actiontype - the action typename - the action nameearliestAction - the earliest execution datepublic static KickstartAction scheduleKickstartAction(KickstartData ksdata, User scheduler, Server srvr, java.util.Date earliestAction, java.lang.String appendString, java.lang.String kickstartHost)
ksdata - KickstartData to associate with this Actionscheduler - User scheduling the action.srvr - Server for which the action affects.earliestAction - Date run the ActionappendString - extra options to add to the action.kickstartHost - host that serves up the kickstart file.public static KickstartAction scheduleKickstartAction(java.util.Set<FileList> fileList, User scheduler, Server srvr, java.util.Date earliestAction, java.lang.String appendString, java.lang.String kickstartHost)
fileList - file preservation lists to be included in the system records.scheduler - User scheduling the action.srvr - Server for which the action affects.earliestAction - Date run the ActionappendString - extra options to add to the action.kickstartHost - host that serves up the kickstart file.public static KickstartGuestAction scheduleKickstartGuestAction(ProvisionVirtualInstanceCommand pcmd, java.lang.Long ksSessionId)
pcmd - most information needed to create this actionksSessionId - Kickstart Session ID to associate with this actionpublic static Action scheduleRebootAction(User scheduler, Server srvr, java.util.Date earliestAction)
scheduler - User scheduling the action.srvr - Server for which the action affects.earliestAction - Date run the Actionpublic static Action scheduleHardwareRefreshAction(User scheduler, Server srvr, java.util.Date earliestAction)
scheduler - User scheduling the action.srvr - Server for which the action affects.earliestAction - Date run the ActionMissingCapabilityException - if scripts cannot be runpublic static Action scheduleHardwareRefreshAction(User scheduler, java.util.Date earliestAction, java.util.Set<java.lang.Long> serverIds)
scheduler - User scheduling the action.earliestAction - Date run the ActionserverIds - server ids meant for the actionMissingCapabilityException - if scripts cannot be runpublic static void scheduleAllErrataUpdate(User scheduler, Server srvr, java.util.Date earliest)
scheduler - Person scheduling the action.srvr - Server whose errata is going to be scheduled.earliest - Earliest possible time action will occur.public static Action schedulePackageInstall(User scheduler, Server srvr, java.lang.Long nameId, java.lang.Long evrId, java.lang.Long archId)
scheduler - The user scheduling the action.srvr - The server that this action is for.nameId - nameId rhnPackage.name_idevrId - evrId of packagearchId - archId of packagepublic static Action schedulePackageAction(User scheduler, java.util.List pkgs, ActionType type, java.util.Date earliestAction, Server... servers)
scheduler - The user scheduling the action.pkgs - A list of maps containing keys 'name_id', 'evr_id' and
optional 'arch_id' with Long values.type - The type of the package action. One of the static types found in
ActionFactoryearliestAction - The earliest time that this action could happen.servers - The server(s) that this action is for.public static Action schedulePackageAction(User scheduler, java.util.List pkgs, ActionType type, java.util.Date earliestAction, java.util.Set<java.lang.Long> serverIds)
scheduler - The user scheduling the action.pkgs - A list of maps containing keys 'name_id', 'evr_id' and
optional 'arch_id' with Long values.type - The type of the package action. One of the static types found in
ActionFactoryearliestAction - The earliest time that this action could happen.serverIds - The server ids that this action is for.public static void addPackageActionDetails(Action action, java.util.List packages)
action - the actionpackages - A list of maps containing keys 'name_id', 'evr_id' and
optional 'arch_id' with Long values.public static java.lang.String getActionName(ActionType type)
type - the typepublic static ScapAction scheduleXccdfEval(User scheduler, Server srvr, java.lang.String path, java.lang.String parameters, java.util.Date earliestAction)
scheduler - User scheduling the action.srvr - Server for which the action affects.path - Path for the Xccdf content.parameters - Additional parameters for oscap tool.earliestAction - Date of earliest action to be executed.public static ScapAction scheduleXccdfEval(User scheduler, java.util.Set<java.lang.Long> serverIds, java.lang.String path, java.lang.String parameters, java.util.Date earliestAction)
scheduler - User scheduling the action.serverIds - Set of server identifiers for which the action affects.path - Path for the Xccdf content.parameters - Additional parameters for oscap tool.earliestAction - Date of earliest action to be executed.MissingCapabilityException - if scripts cannot be runpublic static Action scheduleReboot(User scheduler, Server server, java.util.Date earliestAction)
scheduler - Logged in userserver - Server, which is going to be rebootedearliestAction - Earliest date. If null, then date is current.public static Action scheduleCertificateUpdate(User scheduler, Server server, java.util.Date earliestAction)
scheduler - Logged in userserver - Server, to update the certificate forearliestAction - Earliest date. If null, use current date