Bug 580243 - RFE: Need a way for the CLI to perform Manual Addition of resources.
Summary: RFE: Need a way for the CLI to perform Manual Addition of resources.
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: RHQ Project
Classification: Other
Component: CLI
Version: 1.3pre
Hardware: All
OS: All
high
medium
Target Milestone: ---
: ---
Assignee: Jay Shaughnessy
QA Contact: Sudhir D
URL:
Whiteboard:
Depends On:
Blocks: jon24-cli 578348
TreeView+ depends on / blocked
 
Reported: 2010-04-07 19:43 UTC by Jay Shaughnessy
Modified: 2010-08-12 16:53 UTC (History)
1 user (show)

Fixed In Version: 2.4
Clone Of:
Environment:
Last Closed: 2010-08-12 16:53:50 UTC
Embargoed:


Attachments (Terms of Use)

Description Jay Shaughnessy 2010-04-07 19:43:43 UTC
RFE from the forums:

Need a way for the CLI to perform Manual Addition of resources.

This is missing from the DiscoveryBossRemote API.

Comment 1 Charles Crouch 2010-06-08 03:02:36 UTC
We need this to fully support the alerts firing a script use case, since people may need to inventory lots of existing scripts

Comment 2 Jay Shaughnessy 2010-06-22 19:19:14 UTC
Added to Remote API, DiscoveryBossRemote:

Resource manuallyAddResource(Subject subject,
                                     int resourceTypeId,
                                     int parentResourceId,
                                     Configuration pluginConfiguration)
                             throws Exception

    Manually Add the resource of the specified type to inventory using the specified plugin configuration (i.e. connection properties). This will not only create a new resource, but it will also ensure the resource component is activated (and thus connects to the managed resource).

    Parameters:
        subject - the user making the request
        resourceTypeId - the type of resource to be manually discovered
        parentResourceId - the id of the resource that will be the parent of the manually discovered resource
        pluginConfiguration - the properties that should be used to connect to the underlying managed resource 
    Returns:
        The resource. Note that the resource may have existed already if given the provided pluginConfiguration leads to a previously defined resource. 
    Throws:
        Exception - if connecting to the underlying managed resource failed due to invalid plugin configuration or if the manual discovery fails for any reason.

Comment 3 Charles Crouch 2010-07-21 20:37:26 UTC
Pushing this old issue to ON_QA

Comment 5 Jay Shaughnessy 2010-07-23 19:36:51 UTC
Script for testing:
- Requires at least one platform in inventory.

Manually adds a Script Server resource to a platform.

var c = new ResourceCriteria();

c.addFilterResourceCategory(ResourceCategory.PLATFORM);

platforms = ResourceManager.findResourcesByCriteria(c);

var parentId = platforms.get(0).getId();

var c = new ResourceTypeCriteria();

c.addFilterName("Script Server");

var types = ResourceTypeManager.findResourceTypesByCriteria(c);

var typeId = types.get(0).getId();

var config = new Configuration();

var property = new PropertySimple("executable", "/temp/fake.sh");

config.put( property );

var newResource = DiscoveryBoss.manuallyAddResource(typeId, parentId, config);

Assert.assertNotNull( newResource );

Assert.assertTrue( newResource.getId() > 0 );

Comment 6 Corey Welton 2010-07-23 19:39:56 UTC
QA Verified.  I am sure we can do an in-depth check of methods that this function can call, but for now the call itself is there and seems usable.

Comment 7 Corey Welton 2010-08-12 16:53:50 UTC
Mass-closure of verified bugs against JON.


Note You need to log in before you can comment on or make changes to this bug.