Skip to content

Conversation

@stacywsmith
Copy link
Contributor

Addresses #190.

@stacywsmith
Copy link
Contributor Author

@dgarros Can you please take a look at this?

@dgarros
Copy link
Contributor

dgarros commented Dec 8, 2016

Hi @stacywsmith
There are some commands that return nothing hence I don't think we should make dest mandatory.
have you found an issue because dest was missing ?

@stacywsmith
Copy link
Contributor Author

@dgarros Yes, if dest is not specified an AttributeError exception is raised. Please see the discussion on #190.

@dgarros
Copy link
Contributor

dgarros commented Dec 8, 2016

got it, in this case we should handle the exception properly or check if dest is defined.
I'll give it a try quickly

@stacywsmith
Copy link
Contributor Author

@dgarros The issue is here. We attempt to open the file specified by dest even if the value is None. I think you can simply wrap this block in an if:

        if dest is not None:
            with open(args['dest'], 'w') as outputfile:
                if args['format'] == 'text':
                    outputfile.write(cli_output)
                elif args['format'] == 'xml':
                    outputfile.write(etree.tostring(cli_output))

We also need to clean up the conflicting documentation which says the dest argument is required.

@stacywsmith
Copy link
Contributor Author

Handled by #193.

@stacywsmith stacywsmith deleted the junos_cli_require_dest branch August 23, 2017 17:08
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