Issue #12614 has been updated by Gary Richards.

Right now i'm just trying to talk to a HP ProCurve 2510G-48 L2 managed switch 
and get some facts from it. Then I hope to implement vlans and interfaces 
similar to the existing Cisco code. I also have some HP E4800 L3 managed 
switches (they're actually non rebranded 3com's, which are rebranded H3C S5500 
switches) which I hope to implement similar functionality for at some point 
(but they're less important).

The only reason for the above request was due to the switch i'm testing on. In 
its default config (which is how we hope to one day be able to provision a new 
switch) once you're connected, if you type enable you don't get prompted for a 
password. So the existing puppet code fell over at the first hurdle as there 
was no easy way to say, execute 'enable', expect Password: or expect the 
default prompt.

One thing we've been thinking that we might like to do (in the future) is to 
have puppet configure switch ports on the fly based on a few things. For 
example, it would be nice if we could define a virtual machine to be on a 
certain host. As part of the VM config you would tell puppet which vlans its 
interfaces needed to be connected to. Then using various puppet magic, the VM 
config would configure various switch ports to be configured correctly for 
whichever vlans are required by VMs on a specific host. This sort of thing may 
be a little way off, but it's quite important to us at least initially to be 
able to configure vlans on our switches manually via puppet and we can't do 
that until puppet can actually manage vlans on our switches. So this is 
something i'm vaguely working on whenever time allows.
----------------------------------------
Bug #12614: Possible problem in util/network_device/transport/telnet.rb
https://projects.puppetlabs.com/issues/12614#change-55347

Author: Gary Richards
Status: Accepted
Priority: Normal
Assignee: 
Category: network
Target version: 
Affected Puppet version: 2.7.10
Keywords: 
Branch: 


Hi,

I think there's a bug in util/network_device/transport/telnet.rb

I've been trying to modify a copy of the existing cisco network code work with 
HP Procurve switches and spent a little while trying to work out why I couldn't 
get the enable part to work.

in util/network_device/cisco/device.rb, in the enable method:
    transport.command("enable", :prompt => /^Password:/)

It just so happens the switch I was using to test my changes doesn't have an 
enable password. So when you type 'enable' you get dumped back into slightly 
changed prompt.

Now looking at the code in util/network_device/transport/telnet.rb
    def command(cmd, options = {})
      send(cmd)
      expect(options[:prompt] || default_prompt) do |output|
        yield output if block_given?
      end
    end
    
I think that's supposed to expect either the passed in prompt or the default 
prompt.

Now as suggested, the code that calls enable expects a prompt of Password: so 
looking at the above code, that should match Password: or the default prompt. 
So according to my calculations... that should mean that my switch, which 
doesn't require a password be entered should work with the same code. But it 
doesn't seem to work.

The prompt is never matched. I modified the code in 
util/network_device/cisco/device.rb, in the enable method by removing the 
prompt (to make sure that it only matches the default prompt):
    transport.command("enable")

Lo and behold it matches the default prompt and the enable method works fine.

That suggests to me that the
    options[:prompt] || default_prompt

Part of the code doesn't work however the original developer expected?

I guess it's possible that on cisco devices it's not possible to have no 
password for enable (I have no cisco device to check on)? Regardless of that, 
it's possible this code may be used some somewhere else either now or in the 
future where someone expects it to match a specific prompt or the default 
prompt and it might not work?


-- 
You have received this notification because you have either subscribed to it, 
or are involved in it.
To change your notification preferences, please click here: 
http://projects.puppetlabs.com/my/account

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Bugs" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/puppet-bugs?hl=en.

Reply via email to