Skip to content

Conversation

@jan-cerny
Copy link
Collaborator

Description:

When an user wants to compare only 1 rule, and the rule isn't present in the datastream, for example the user makes a typo in --rule-id value, the script will fail.

Rationale:

When user wants to compare only 1 rule, and the rule isn't present
in the datastream, for example the user makes a typo in --rule-id
value, the script will fail.
@jan-cerny jan-cerny added this to the 0.1.47 milestone Oct 25, 2019
@yuumasato yuumasato self-assigned this Oct 29, 2019
rules = benchmark.findall(
".//xccdf:Rule[@id='%s']" % (rule_id), ns)
if len(rules) == 0:
raise ValueError("Can't find rule %s" % (rule_id))
Copy link
Member

Choose a reason for hiding this comment

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

How about catching this exceptions somewhere and printing a nice message instead of tracebacking?

@jan-cerny
Copy link
Collaborator Author

I have caught the exception.

@yuumasato
Copy link
Member

@jan-cerny Nice catch. 😆

@yuumasato yuumasato merged commit 4ef7011 into ComplianceAsCode:master Oct 30, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants