Skip to content
This repository has been archived by the owner on Nov 29, 2021. It is now read-only.

Add <get_performance> #131

Merged
merged 5 commits into from
Sep 3, 2019
Merged

Conversation

jjnicola
Copy link
Member

@jjnicola jjnicola commented Sep 2, 2019

Allows to execute a external program/script and get the response.
The program must be named 'gvmcg' and should receive up to 3 arguments
called start, end and titles.

Example with gvm-cli:

gvm-cli --protocol OSP socket --socketpath=/run/ospd/openvas.sock --xml "<get_performance start='0' titles='titles'/>"

Allows to execute a external program/script and get the response.
The program must be named 'gvmcg' and should receive up to 3 arguments
called start, end and titles.

Example with gvm-cli:

```
gvm-cli --protocol OSP socket --socketpath=/run/ospd/openvas.sock --xml "<get_performance start='0' titles='titles'/>"

```
@codecov
Copy link

codecov bot commented Sep 2, 2019

Codecov Report

Merging #131 into master will increase coverage by 0.48%.
The diff coverage is 93.93%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #131      +/-   ##
==========================================
+ Coverage   68.38%   68.87%   +0.48%     
==========================================
  Files          12       12              
  Lines        1705     1738      +33     
==========================================
+ Hits         1166     1197      +31     
- Misses        539      541       +2
Impacted Files Coverage Δ
ospd/ospd.py 73.65% <93.93%> (+0.89%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 65f1c58...16e23bf. Read the comment docs.

Copy link
Contributor

@bjoernricks bjoernricks left a comment

Choose a reason for hiding this comment

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

Just one nitpicking change :-)

ospd/ospd.py Outdated
titles = scan_et.attrib.get('titles')

cmd = list()
cmd.append('gvmcg')
Copy link
Contributor

Choose a reason for hiding this comment

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

Can be sumarized in one line

Suggested change
cmd.append('gvmcg')
cmd = ['gvmcg']

ospd/ospd.py Outdated
end = scan_et.attrib.get('end')
titles = scan_et.attrib.get('titles')

cmd = list()
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
cmd = list()

cmd = secET.fromstring(
'<get_performance start="a" end="0" titles="mem"/>')

self.assertRaises(
Copy link
Contributor

Choose a reason for hiding this comment

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

Personally I would use the with statement for assert raises (see https://docs.python.org/3/library/unittest.html#unittest.TestCase.assertRaises) but it's up to you :-)

Copy link
Member Author

Choose a reason for hiding this comment

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

Other tests don't use the with statement for assert raises neither. I will do this in a future PR.

@bjoernricks bjoernricks merged commit 2bab83b into greenbone:master Sep 3, 2019
@jjnicola jjnicola deleted the get_performance branch September 3, 2019 09:55
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.

2 participants