RFE from the forums: Need a way for the CLI to perform Manual Addition of resources. This is missing from the DiscoveryBossRemote API.
We need this to fully support the alerts firing a script use case, since people may need to inventory lots of existing scripts
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.
Pushing this old issue to ON_QA
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 );
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.
Mass-closure of verified bugs against JON.