--- ler762@gmail.com wrote: From: Lee <ler762@gmail.com>
I have a file with 1000s of devices and another file with a list of commands. The program issues all commands for a device and then moves on to the next one using nested loops. In the debug I see the "spawn_id expNN" (where NN is a number that, I believe is representative of the number of file descriptors used in the system) increment only when a device does not respond. As long as a device responds before the timeout period I see the expNN number does not increase. As soon as a device doesn't respond the expNN count goes up and I can't figure out why. Once I hit a certain expNN the <snip>
:: 'close $spawn_id' is wrong, so maybe that's it? :: man expect :: close [-slave] [-onexec 0|1] [-i spawn_id] :: closes the connection to the current process. :: ... The -i :: flag declares the :: process to close corresponding to the named :: spawn_id. <.. snip ..> ---------------------------------------- I hand typed the close stuff in the email with just 'close spawn_id'. I did the -i in previous iterations, but saw no difference. Maybe I should try more. I saw the 'close' alone a lot on Stackexchange a lot,so I was copying those in this iteration. I also should have read the man page more than I did, so a face slap to myself. :: No matter whether the connection is closed :: implicitly or explicitly, you should call wait to :: clear up the corresponding kernel process slot. :: close does not call wait since there is no guarantee :: that closing a process connection will cause it to :: exit. See wait below for more info. :: The eof and timeout cases are basically :: { catch {close}; catch {wait}; } I always used wait after close and need to look into those above. Maybe they close it different somehow. :: get rancid from here... and take a look at clogin... I'm going to be looking for a new job and want to up my skills, in case I get a chance to do the SDN/NFV stuff, which I read requires coding skills, so this is also an exercise toward that. Plus it's fun. I had already done this in PERL, but, even though we have PERL, we are not allowed to download modules here. So, I'm redoing it in Expect. I thought someone would say a "oh just <blah, blah> and you're done" type of response. Thanks a lot from everyone private and on the list. I'll post for the archives if I find the answer. scott
* surfer@mauigateway.com (Scott Weeks) [Sat 21 Jul 2018, 22:38 CEST]:
I had already done this in PERL, but, even though we have PERL, we are not allowed to download modules here. So, I'm redoing it in Expect. I thought someone would say a "oh just <blah, blah> and you're done" type of response.
Well, what you're doing right here is reimplementing rancid. Which is wholly unnecessary because we already have rancid, and a more modern alternative named oxidized. And you've gotten that response already. Fine as a personal exercise, of course. The inability to download modules seems sadistic to me, though. -- Niels.
On Sun, 22 Jul 2018 00:43:35 +0200, Niels Bakker said:
Fine as a personal exercise, of course. The inability to download modules seems sadistic to me, though.
And given the adage "Never create a rule you can't enforce", I wonder how they enforce it - have to be pretty hardcore to make sure that stuff doesn't get imported via USB or tethering off a cellphone. (Or more correctly, I know how they do those sort of things if you're a spook agency or doing classified research - how do you make it palatable to employees in corporate sites?)
Have you looked into utilizing Ansible? On Sat, Jul 21, 2018 at 8:22 PM <valdis.kletnieks@vt.edu> wrote:
On Sun, 22 Jul 2018 00:43:35 +0200, Niels Bakker said:
Fine as a personal exercise, of course. The inability to download modules seems sadistic to me, though.
And given the adage "Never create a rule you can't enforce", I wonder how they enforce it - have to be pretty hardcore to make sure that stuff doesn't get imported via USB or tethering off a cellphone. (Or more correctly, I know how they do those sort of things if you're a spook agency or doing classified research - how do you make it palatable to employees in corporate sites?)
On Sun, 22 Jul 2018 00:10:06 -0400, J Crowe said:
Have you looked into utilizing Ansible?
Yes, we use Ansible heavily on production services. But Ansible doesn't *stop* somebody from downloading modules, especially if it's a laptop used for diagnosis/testing.
participants (4)
-
J Crowe
-
Niels Bakker
-
Scott Weeks
-
valdis.kletnieks@vt.edu