Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

oxs - JunOS command with newlines (\n) fails #8

Closed
spaprzycki opened this issue Aug 18, 2016 · 4 comments
Closed

oxs - JunOS command with newlines (\n) fails #8

spaprzycki opened this issue Aug 18, 2016 · 4 comments

Comments

@spaprzycki
Copy link

I am trying to use oxs to apply announcement banner to JunOS. Commands come from file, something like this:
configure
set system announcement "\nThis is my announcement\n123\n"
commit and-quit
quit

Above fails. When running in debug mode I can see that oxs is interpreting newline (and so actually enters newline into Junos CLI instead of \n as text).

I have tried escaping \n with additional , but that still fails, so I started looking into why. I spotted line 85 in cli.rb:

line.sub!(/\\n/, "\n") # tread escaped newline as newline

I don't know ruby, but to me it looks like it does exactly what comment says (no surprise here), but I am trying to figure out why it does this. For a quick test I have changed this line to:

line.sub!(/\\n/, "\\n") # tread escaped newline as newline

which to me means that it will replace new line with escaped new line. This makes my above command list apply successfully.

As mentioned above I don't know ruby enough to be able to evaluate what could my change break, so I have reverted it for now and decided to ask for some advice here.

Hope above is clear enough.

@nertwork
Copy link
Contributor

So, commenting out the newline appears to have fixed the issue, with no known side-effects. I've added it to my most recent PR and am just waiting on ytti to accept the PR (#10)

@nertwork
Copy link
Contributor

The fix for this should be pushed up to rubygems - let me know if this fixed your problems, as it did mine.

Copy link

This issue is stale because it has been open 90 days with no activity.

@nickhilliard
Copy link
Collaborator

confirmed working in aabf808

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

No branches or pull requests

3 participants