Bug 1486362

Summary: [RFE] Add API call for container scanning via SmartState
Product: Red Hat CloudForms Management Engine Reporter: Robb Manes <rmanes>
Component: APIAssignee: Gregg Tanzillo <gtanzill>
Status: CLOSED ERRATA QA Contact: juwatts
Severity: low Docs Contact:
Priority: medium    
Version: 5.8.0CC: bpritche, dmcmille, epacific, fsimonce, jhardy, lavenel, obarenbo, oourfali, simaishi, smallamp
Target Milestone: MVPKeywords: FutureFeature
Target Release: 5.10.0   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard: container
Fixed In Version: 5.10.0.0 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of:
: 1552279 (view as bug list) Environment:
Last Closed: 2019-02-07 23:02:39 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: Container Management Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 1511957, 1552279, 1555371, 1597407    

Description Robb Manes 2017-08-29 14:57:07 UTC
Description of problem:
While there is an API call to begin scans via SmartState for Virtual Machines (http://manageiq.org/docs/reference/latest/api/reference/vms), there is no API call to do so with containers despite being able to be invoked from the UI.

As a workaround, the container can be directly queried for SmartState Analysis via the console like so:

image = ContainerImage.find_by(:id => id_value) ; image.scan()

However, API access is more desirable for obvious reasons (remote access, etc).

Version-Release number of selected component (if applicable):
Latest/any version of CFME or MIQ

Additional info:
This was opened as a Request for Feature Enhancement by our own internal Red Hat IT Team, which desires this feature for management of containers.

Comment 10 juwatts 2018-09-24 17:59:43 UTC
CFME Version:
5.10.0.16.20180919151347_a0c9e02


Verification steps using  miq-rest-api-client-python:

#get the provider crud object
ocp = providers.get_crud('ocp-39-hawk')

# Get the REST Entity
image = ocp.appliance.rest_api.collections.container_images.get(name='dotnet/dotnet-20-runtime-rhel7')

image
Out[16]: <Entity u'https://10.8.197.248/api/container_images/150'>


#verified the entity has the scan action:
image.action.all
Out[5]: [u'scan']

#Initiated the SmartState Analysis Scan
image.action.scan()
Out[4]: <Entity u'https://10.8.197.248/api/container_images/150'

#Verified the scan was successfull
ocp.appliance.rest_api.collections.tasks.all
[<Entity u'https://10.8.197.248/api/tasks/27'>]

task = ocp.appliance.rest_api.collections.tasks.get(id='27')

task
<Entity u'https://10.8.197.248/api/tasks/27'>

task.name
u"Container Image Analysis: 'dotnet/dotnet-20-runtime-rhel7'"

task.state
u'Finished'

task.status
u'Ok'

#Verified the 'last scan attempt on'

image.last_scan_attempt_on
datetime.datetime(2018, 9, 24, 17, 31, 4, tzinfo=<iso8601.Utc>)

Comment 12 errata-xmlrpc 2019-02-07 23:02:39 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHSA-2019:0212

Comment 13 Red Hat Bugzilla 2023-09-14 04:07:03 UTC
The needinfo request[s] on this closed bug have been removed as they have been unresolved for 1000 days