Bug 729289

Summary: CLI: when scheduling an operation, no error is returned if an invalid operation name is specified
Product: [Other] RHQ Project Reporter: Ondřej Žižka <ozizka>
Component: CLIAssignee: Ian Springer <ian.springer>
Status: CLOSED NOTABUG QA Contact: Mike Foley <mfoley>
Severity: low Docs Contact:
Priority: medium    
Version: 3.0.1CC: ccrouch, hrupp, ian.springer
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2011-08-10 19:10:38 UTC Type: ---
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:    
Bug Blocks: 678340, 725459    

Description Ondřej Žižka 2011-08-09 11:34:53 UTC
STR:

1) Inventorize EAP 5.1.1
2) In CLI, find AS
3) Run stop operation - 
  OperationManager.scheduleResourceOperation(  as.id, "stop", 0, 1, 0, 2*60*1000, new Configuration(), "JBoss AS stop test" );

The operation does not appear in GUI;
And nothing happens (EAP runs on).

--------------------------------------------------------------------

rhqadmin.lab.eng.bos.redhat.com:7080$ as
Resource:
                         id: 11043
                       name: stacks2.mw.lab.eng.bos.redhat.com:1099 all
                    version: 5.1.1
        currentAvailability: UP
               resourceType: JBossAS Server

rhqadmin.lab.eng.bos.redhat.com:7080$     var sch = OperationManager.scheduleResourceOperation(  as.id, "stop", 0, 1, 0, 2*60*1000, new Configuration(), "JBoss AS stop test" );

rhqadmin.lab.eng.bos.redhat.com:7080$ sch
ResourceOperationSchedule:
        resource: Resource[id=11043, type=JBossAS Server, key=/root/eap/server/all, name=stacks2.mw.lab.eng.bos.redhat.com:1099 all, parent=stacks2.mw.lab.eng.bos.redhat.com, version=5.1.1]

Comment 1 Ondřej Žižka 2011-08-09 11:59:13 UTC
Is it "shutdown"? Why didn't it throw an exception then.
And, "start" did not either.

Comment 2 Ian Springer 2011-08-09 14:49:31 UTC
Yes, it's "shutdown". Here are the ops defined in the plugin descriptor:

        <operation name="start" displayName="Start"
                   description="Start this application server. The script used is specified in the Operations group of connection properties. This operation will fail if the server is already started.">
          <results><c:simple-property name="operationResult" description="Outcome of starting the server."/></results>
        </operation>

        <operation name="shutdown" displayName="Shut Down"
                   description="Shut down this application server via script or JMX, depending on the settings in the Operations and Advanced groups of connection properties. This operation will fail if the server is already shut down.">
          <results><c:simple-property name="operationResult" description="Outcome of shutting down the server."/></results>
        </operation>

        <operation name="restart" displayName="Restart"
                   description="Shut down (if started) and then start this application server.">
          <results><c:simple-property name="operationResult" description="Outcome of restarting the server."/></results>
        </operation>

I agree. it should have thrown an "Unknown operation 'stop'." exception.

Comment 3 Ian Springer 2011-08-09 17:51:38 UTC
scheduleResourceOperation() and scheduleGroupOperation() now validate that the specified operation name and parameters are valid for the specified Resource. If not, they throw an IllegalArgumentException - [master f8c0c68].

Comment 4 Ondřej Žižka 2011-08-10 14:42:33 UTC
Thx, that will help.

Comment 5 Ondřej Žižka 2011-08-10 15:55:35 UTC
Setting priority to low since it turned to be an ID-10-T error (I copied a script from somewhere without checking rhq-plugin.xml).
Can be closed, as far as I am concerned.

Comment 6 Mike Foley 2011-08-10 19:10:38 UTC
closing, per bug loggers ID-10-T comment (user error)