Hi You defined the function as def baseconfig(ipvzero): ipvzero.run(kwargs) more stuff Then you use it as results = nr.run(task = baseconfig) This bit is a tad confusing to me, I'm more accustomed to seeing the argument being passed to the function in a manner; result = function(args) where the function will also have a return statement. With this line results = nr.run(task = baseconfig) What is the argument that is being passed to baseconfig as ipvzero? Was hoping for something similar to baseconfig(nr) where nr is the argument being passed to the baseconfig function. What is happening there?
This script was an old script I used to demo basic Nornir functionality. When creating a custom function it'll take argument typically called "task" - but just to highlight that there's nothing inherently special about the name task I changed it to ipvzero. You then take that object, in this case called "ipvzero" and use the run method. Nornir's concept is tasks is that they're basically functions that act per host. So when im saying ipvzero.run it's basically - run this for each host in the inventory. At the very end I use the nr object to nr.run the name of the custom function for all devices in parallel - in this case nr.run(task=baseconfig). Hope this helps! Nornir's documentation might help here: nornir.readthedocs.io/en/3.0.0/tutorial/tasks.html -John
You used 'd500j' to delete to the end of the file, assuming 500 would be enough. In vim the 'G' command takes you to the end of file. So 'dG' is the better way as there is no guessing and less typing :-) Very good video by the way.
Hi Coming from desktop editors Sublime and Atom and nano on terminal... I'm planning to check out vim, mind sharing your vim config file? I would like to start from there ;)
Hey Basondole. I chop and change my Vim file quite a lot. The only things that's always consistent is having a visual bell and relative number is always on haha. Definitely check out Vim, though. It's a great editor :)
Never realized how useful relative numbering could be until now. Thanks for the great overview!
Glad it helped, Ana! Yup, relative number is a lifesaver haha!
-John
This is a great overview of power of VIM. I am a big fan of it, but didn't know most of what you have shown. :)
Thanks Sergey! Vim is amazing. I'm always finding out new cool features I never knew about either :)
-John
Hi
You defined the function as
def baseconfig(ipvzero):
ipvzero.run(kwargs)
more stuff
Then you use it as
results = nr.run(task = baseconfig)
This bit is a tad confusing to me, I'm more accustomed to seeing the argument being passed to the function in a manner; result = function(args) where the function will also have a return statement.
With this line results = nr.run(task = baseconfig) What is the argument that is being passed to baseconfig as ipvzero?
Was hoping for something similar to baseconfig(nr) where nr is the argument being passed to the baseconfig function.
What is happening there?
This script was an old script I used to demo basic Nornir functionality. When creating a custom function it'll take argument typically called "task" - but just to highlight that there's nothing inherently special about the name task I changed it to ipvzero. You then take that object, in this case called "ipvzero" and use the run method. Nornir's concept is tasks is that they're basically functions that act per host. So when im saying ipvzero.run it's basically - run this for each host in the inventory. At the very end I use the nr object to nr.run the name of the custom function for all devices in parallel - in this case nr.run(task=baseconfig).
Hope this helps! Nornir's documentation might help here:
nornir.readthedocs.io/en/3.0.0/tutorial/tasks.html
-John
@@IPvZero I'm confused by the method of passing the object to the function. I'll go thru the documentation perhaps it'll help.
Been trying to use the "ciw" command but everytime I hit the "i" in "ciw" it takes me to INSERT mode. How do you deal with that?
Sounds like an error in your vimrc. Do you have comments on the same lines as your mappings?
I liked it!
Thanks, Matias!
You used 'd500j' to delete to the end of the file, assuming 500 would be enough. In vim the 'G' command takes you to the end of file. So 'dG' is the better way as there is no guessing and less typing :-)
Very good video by the way.
Haha great tip, Phil! Love it!
That's the thing with Vim there's an endless supply of new things to learn :)
-John
Hi
Coming from desktop editors Sublime and Atom and nano on terminal... I'm planning to check out vim, mind sharing your vim config file? I would like to start from there ;)
Hey Basondole. I chop and change my Vim file quite a lot. The only things that's always consistent is having a visual bell and relative number is always on haha. Definitely check out Vim, though. It's a great editor :)
No need to delete from the cursor to end of file by using d500j, use dG
I should have read the comments :)