Bug 768099

Summary: Drift definitions can be created for resources that do not support drift using remote APIs
Product: [Other] RHQ Project Reporter: John Sanda <jsanda>
Component: driftAssignee: John Sanda <jsanda>
Status: ASSIGNED --- QA Contact: Mike Foley <mfoley>
Severity: medium Docs Contact:
Priority: unspecified    
Version: 4.2   
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---
Bug Depends On:    
Bug Blocks: 760116    

Description John Sanda 2011-12-15 13:38:12 EST
Description of problem:
Using the remote APIs, you can create drift definitions for resources of types that do not support drift. This does not result in an errors of which I am aware. The problem is that there is no drift UI for types that do not support drift. A user could script creating definitions for resources that don't support drift, get no errors, and then have no way to view drift data in the UI.

Since we do not support creating definitions in the UI for types that do not support drift, then we need to be consistent with that behavior in the remote APIs

Version-Release number of selected component (if applicable):

How reproducible:

Steps to Reproduce:
1. Log into the CLI
2. Create a drift definition for a resource that does not support drift (like an agent)
Actual results:
The definition is created without error. You can verify in two ways. 1) Look in the database in the rhq_drift_definition table. 2) Look in your agent installation and you should find the following file <AGENT_HOME>/data/changesets/<resource_id>/<drift_definition_name>/changeset.txt.

Expected results:
The definition should not get created and an exception should get thrown.

Additional info:
Comment 1 John Sanda 2011-12-19 09:23:44 EST
A few validation checks have been added.

1. make sure that the resource in fact supports drift management

2. if the definition has a template attached, make sure that the template exists in the database

3. if the definition has a template attached, make sure the template is from the same resource type as the type of the resource for which the definition is being created.

master commit hash: 615c99b2a0d856b316b558a4e6fd7989b4004a15
Comment 2 Mike Foley 2011-12-19 10:31:03 EST
requesting dev to attach CLI script or snippet to support the repro steps ...