junos config commit question

On an EX4300 switch running JunOS 14.1 let's imagine I typed

  config
  delete interfaces

before coming to my senses. How am I supposed to back out of that
mess? For the life of me, after a week of reading the 3000 page
reference manual, and endless DuckDuckGoing, I cannot see a simple
way of just abandoning the commit. I've got to be missing something
stunningly obvious here because it's unthinkable that this functionality
doesn't exist. Help?!?

The only way out I can see is to drop into the shell, make an
uncompressed copy of juniper.conf.gz, then pop back into the config
editor and load that over top of the editor's config view. Surely
there's a saner way of dealing with this.

--lyndon

rollback 0

If it’s before committing the changes just run “top” to get back to the root of the configuration tree, then “rollback 0” to go back to the version before any changes were made, then just “exit” out.

Ryan

If it’s before committing the changes just run “top” to get back to the root of the configuration tree, then “rollback 0” to go back to the version before any changes were made, then just “exit” out.

Ryan

On an EX4300 switch running JunOS 14.1 let’s imagine I typed

config
delete interfaces

you may ALSO be interested in the idea that you SHOULD be doing:
configure exclusive
fiddle
fart
oops!
exit (safe to exit, your changes will get wiped out)

note that ‘configure exclusive’ means other people can’t ALSO change the config out from under you (and you have locked the config, so…)

What would you say if I told you a coworker once did exactly that, and did commit and-quit...and it had to be fixed by another coworker getting to it via OOB console and doing the rollback? :slight_smile:

top [not necessary in your case, if you never left top]
rollback 0
quit

Also, get into the habit of never doing a commit without first doing
top show | compare
so you can see what your change is actually doing to the whole config. i.e. if you did a show | compare at the top of the config and saw the entire interfaces section of the config was "removed" in the resulting config diff, you probably wouldn't commit.

Marco Davids via NANOG writes:

rollback 0

OFFS 8-0 Thanks :slight_smile:

I was actually interested to see if the EX series would let me do this, and it turns out that if STP is enabled on any of the switch interfaces, it won't:

tevruden@core-02# delete interfaces

{master:0}[edit]
tevruden@core-02# commit check
[edit protocols rstp]
  'interface'
    XSTP : Interface ge-0/0/0.0 is not enabled for Ethernet Switching
error: configuration check-out failed
{master:0}[edit]
tevruden@core-02# rollback
load complete

{master:0}[edit]

Nick Suan via NANOG writes:

I was actually interested to see if the EX series would let me do this, and i
t turns out that if STP is enabled on any of the switch interfaces, it won't:
tevruden@core-02# commit check
[edit protocols rstp]
  'interface'
    XSTP : Interface ge-0/0/0.0 is not enabled for Ethernet Switching
error: configuration check-out failed

Do you have any rstp-specific overrides in your config? E.g. we
have things like this in some of ours:

  rstp {
      interface ge-0/0/45 {
          cost 1000;
          mode point-to-point;
      }
      interface ge-1/0/45 {
          cost 1000;
          mode point-to-point;
      }
      interface ae4;
      bpdu-block-on-edge;
  }

With the interfaces gone I would expect the commit check to fail.

--lyndon

My first question is how are you running 14 code on that hardware??

On an EX4300 switch running JunOS 14.1 let’s imagine I typed

config
delete interfaces

before coming to my senses. How am I supposed to back out of that
mess? For the life of me, after a week of reading the 3000 page
reference manual, and endless DuckDuckGoing, I cannot see a simple
way of just abandoning the commit. I’ve got to be missing something
stunningly obvious here because it’s unthinkable that this functionality
doesn’t exist. Help?!?

What would you say if I told you a coworker once did exactly that, and did
commit and-quit…and it had to be fixed by another coworker getting to it
via OOB console and doing the rollback? :slight_smile:

top [not necessary in your case, if you never left top]
rollback 0
quit

Also, get into the habit of never doing a commit without first doing
top
show | compare
so you can see what your change is actually doing to the whole config.

My muscle memory includes:
{ some changes }
top
show | compare
commit confirmed 5
{flip over the little electronic egg timer thingie that lives next to my keyboard, so that it beeps after 3 minutes…wait… wait… press enter a few times to make sure I haven’t screwed myself…}
commit

If I skip the egg timer, then I will forget, and it will automatically roll back. One of my largest annoyances with the Juniper CLI (other than the fact that it won’t format large numbers into a human readable format in things like ‘monitor interface traffic’) is that it beeps the terminal after it times out the commit.

Gee, thanks for letting me know you just blew away all of my changes… couldn’t you have done that 1 minute before automatically reverting!!!

W

That is always my habit, with plenty of muscle memory... "show | compare".

I have often found it interesting how many folk have muscle memory for "commit and-quit", including Juniper's own staff when I've had the pleasure of being with them on a PoC. It's almost as if I missed an entire period of Junos where that was deemed to be good practice :-).

Mark.

Hey Mark,

More like driving with the hand break still engaged.

Not long enough to have drive to the DC in the middle of the night :slight_smile:

Even “commit confirmed x” is a shield, a better one.

You're correct.

This the lab setup and rstp was set to the default, so I only got the commit check to pass only when I deleted [protocols rstp].

On an EX4300 switch running JunOS 14.1 let's imagine I typed

  config
  delete interfaces

before coming to my senses. How am I supposed to back out of that
mess?

top
rollback

For the life of me, after a week of reading the 3000 page
reference manual, and endless DuckDuckGoing, I cannot see a simple
way of just abandoning the commit. I've got to be missing something
stunningly obvious here because it's unthinkable that this functionality
doesn't exist. Help?!?

You can also do:
config
<do something stupid>
commit
rollback 1
commit

And still get back to where you were before <do something stupid>

The only way out I can see is to drop into the shell, make an
uncompressed copy of juniper.conf.gz, then pop back into the config
editor and load that over top of the editor's config view. Surely
there's a saner way of dealing with this.

Much.

Owen

If I skip the egg timer, then I *will* forget, and it will automatically roll back. One of my largest annoyances with the Juniper CLI (other than the fact that it won't format large numbers into a human readable format in things like 'monitor interface traffic') is that it beeps the terminal *after* it times out the commit.

Gee, thanks for letting me know you just blew away all of my changes... couldn't you have done that 1 minute before automatically reverting?!!!

At least you can get them back easily…

configure
rollback 1
commit

It turns out that when Juniper does a rollback from a commit confirm, it treats both the commit confirm and the rollback as full configuration commits.

Owen

Owen DeLong writes:

top
rollback

I am *sure* I tried exactly that but it wasn't working as I expected.
But maybe I was just imagining things. And somehow I completely
missed the 'rollback 0' variant while plowing through the
documentation.

Thanks everyone for assisting the blind :wink:

--lyndon

Unless you're remote and <do something stupid> breaks your ability to reach the box. Then you're hosed after the first "commit".

that's what the "commit confirm xxx" command is for. :slight_smile:

Andrew