Skip to content
This repository was archived by the owner on Oct 10, 2020. It is now read-only.

dbus: Add convenience method for scan results lookup#874

Closed
baude wants to merge 1 commit intoprojectatomic:masterfrom
baude:dbus_vul_methods
Closed

dbus: Add convenience method for scan results lookup#874
baude wants to merge 1 commit intoprojectatomic:masterfrom
baude:dbus_vul_methods

Conversation

@baude
Copy link
Member

@baude baude commented Feb 6, 2017

In the case of cockpit, it would be preferable to be able
to lookup scan results by a container or image's id. If the
container or image has not been scanned, we throw an exception;
otherwise we return the resulting json file as a str.

One other possible exception can be thrown when attempting to read
the desired file from the filesystem. If the file cannot be read,
an exception will be thrown. Either way, it is a clear indicator
that the object needs to be scanned for fresh results.

The following is a simple python example:

from atomic_dbus_client import AtomicDBus
ad = AtomicDBus()
results = ad.get_scan_results_by_id('6858a846fb6b557331e068252fd910b5dc93f8e6341e641400bf4582dc34e10d')

Note the use of the full ID. As of now, we only look up against the full id
as opposed to the short id form which is often used.

@baude
Copy link
Member Author

baude commented Feb 6, 2017

@larskarlitski PTAL

Copy link
Contributor

@larskarlitski larskarlitski left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great, thanks. Please rename the D-Bus method to GetScanResultsById() to be consistent with the other methods.

def get_scan_results_by_id(self, iid):
return self.dbus_object.get_scan_results_by_id(iid, dbus_interface="org.atomic")


Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we want all these open lines?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

will tighten up

In the case of cockpit, it would be preferable to be able
to lookup scan results by a container or image's id.  If the
container or image has not been scanned, we throw an exception;
otherwise we return the resulting json file as a str.

One other possible exception can be thrown when attempting to read
the desired file from the filesystem.  If the file cannot be read,
an exception will be thrown.  Either way, it is a clear indicator
that the object needs to be scanned for fresh results.

The following is a simple *python* example:

from atomic_dbus_client import AtomicDBus
ad = AtomicDBus()
results = ad.GetScanResultsById('6858a846fb6b557331e068252fd910b5dc93f8e6341e641400bf4582dc34e10d')

Note the use of the full ID.  As of now, we only look up against the full id
as opposed to the short id form which is often used.
@baude baude changed the title dbus: Add convenience method for scan results lookup (do not merge until larskarlitski acks) dbus: Add convenience method for scan results lookup Feb 8, 2017
@baude
Copy link
Member Author

baude commented Feb 8, 2017

@rhatdan this is ready for merge

@rhatdan
Copy link
Member

rhatdan commented Feb 8, 2017

@rh-atomic-bot r+

@rh-atomic-bot
Copy link

📌 Commit 6193594 has been approved by rhatdan

@baude
Copy link
Member Author

baude commented Feb 8, 2017

@rh-atomic-bot r+ 6193594

@rh-atomic-bot
Copy link

⌛ Testing commit 6193594 with merge 7270b3b...

rh-atomic-bot pushed a commit that referenced this pull request Feb 8, 2017
In the case of cockpit, it would be preferable to be able
to lookup scan results by a container or image's id.  If the
container or image has not been scanned, we throw an exception;
otherwise we return the resulting json file as a str.

One other possible exception can be thrown when attempting to read
the desired file from the filesystem.  If the file cannot be read,
an exception will be thrown.  Either way, it is a clear indicator
that the object needs to be scanned for fresh results.

The following is a simple *python* example:

from atomic_dbus_client import AtomicDBus
ad = AtomicDBus()
results = ad.GetScanResultsById('6858a846fb6b557331e068252fd910b5dc93f8e6341e641400bf4582dc34e10d')

Note the use of the full ID.  As of now, we only look up against the full id
as opposed to the short id form which is often used.

Closes: #874
Approved by: baude
@rh-atomic-bot
Copy link

💔 Test failed - status-redhatci

@jlebon
Copy link
Contributor

jlebon commented Feb 8, 2017

@rh-atomic-bot retry

@rh-atomic-bot
Copy link

⌛ Testing commit 6193594 with merge e479137...

rh-atomic-bot pushed a commit that referenced this pull request Feb 8, 2017
In the case of cockpit, it would be preferable to be able
to lookup scan results by a container or image's id.  If the
container or image has not been scanned, we throw an exception;
otherwise we return the resulting json file as a str.

One other possible exception can be thrown when attempting to read
the desired file from the filesystem.  If the file cannot be read,
an exception will be thrown.  Either way, it is a clear indicator
that the object needs to be scanned for fresh results.

The following is a simple *python* example:

from atomic_dbus_client import AtomicDBus
ad = AtomicDBus()
results = ad.GetScanResultsById('6858a846fb6b557331e068252fd910b5dc93f8e6341e641400bf4582dc34e10d')

Note the use of the full ID.  As of now, we only look up against the full id
as opposed to the short id form which is often used.

Closes: #874
Approved by: baude
@rh-atomic-bot
Copy link

💔 Test failed - status-redhatci

@rhatdan
Copy link
Member

rhatdan commented Feb 9, 2017

@rh-atomic-bot retry

@rh-atomic-bot
Copy link

⌛ Testing commit 6193594 with merge b0cd193...

@rh-atomic-bot
Copy link

☀️ Test successful - status-redhatci
Approved by: baude
Pushing b0cd193 to master...

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants