Skip to content

Conversation

@nirupaman
Copy link

No description provided.


def check_response(self, resp):
for r in resp:
if 'error' in str.lower(r) or 'invalid' in str.lower(r) or 'the schedule format' in str.lower(r):
Copy link
Owner

Choose a reason for hiding this comment

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

How does 'the schedule format' point to an error? Could you paste the exact command and the error output

Copy link
Author

Choose a reason for hiding this comment

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

The schedule format is or by @hourly @daily @monthly @Weekly @monthly @Yearly

Copy link
Owner

Choose a reason for hiding this comment

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

Please paste the entire command and its original output

Copy link
Author

Choose a reason for hiding this comment

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

CSSOS-SSA04 cli% createsched "createsv snap volume_ansible_a" year sched
The schedule format is or by @hourly @daily @monthly @Weekly @monthly @Yearly

Copy link
Owner

Choose a reason for hiding this comment

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

Add another check comparing the complete string. The reason for that is that the substring we are trying to find has the potential to appear in other places as well. We can't always be sure if this will only occur in this scenario

Copy link
Author

Choose a reason for hiding this comment

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

done

" '%(err_resp)s' ") %
{'err_resp': err_resp})
raise exceptions.HTTPNotFound(reason=err)
except exceptions.HTTPNotFound as ex:
Copy link
Owner

Choose a reason for hiding this comment

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

Since we are not making any HTTP REST call, this exception is not right.

We must have an SSH related exception wherever we are only making CLI call. Look at exception.py for an exception you can use, or else extend the SSHException to reflect the correct exception

This holds true everywhere we are generically throwing HTTPNotFound exception and no REST/HTTP calls are placed

Copy link
Author

@nirupaman nirupaman Oct 26, 2018

Choose a reason for hiding this comment

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

done

Copy link
Owner

Choose a reason for hiding this comment

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

Just replacing a generic SSHException will not help. We need to be more specific when raising exception.

Look at exceptions.py and create the exception you need by extending SSHExceptions.

Copy link
Author

Choose a reason for hiding this comment

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

should i use SSHException? or should i create DeleteScheduleException class in exception.py.
As per code , if Command fails it will be due to sshexception only

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