Hi all,
I'm new to Fabric 2, though in the past I'd used 1 a lot. I can find docs on 
using SerialGroup, but only with run directly. I'm using interactive mode 
authentication, so it seems like I need to gather a password (that's fine, I'm 
doing it via getpass) and also pass kwargs into Connection.  I have a large 
list of hosts, and also was planning to use @task decorators.

What I have right now is a muddle between the two which obviously won't work, 
but I can't figure out how to glue the three
concepts of having a defined group, a task which can be specified from the cli, 
and an interactive user/pass sequence together.


import getpass
from fabric import Connection, group
from invoke import task

switch_group = group.SerialGroup(switch1', 'switch2', 'switch3')

pw = getpass.getpass("Password for netuser?")

@task
def inventory(c):    <-- This is purely here because tasks will error out if a 
kwarg 'Context(..?)' isn't specified
    with Connection(user = 'user', connect_kwargs = {'password' : pw }) as c:
        switch_group.run('show chassis hardware')

It's failing out with 'TypeError: __init__() takes at least 2 arguments (3 
given)'


_______________________________________________
Fab-user mailing list
[email protected]
https://lists.nongnu.org/mailman/listinfo/fab-user

Reply via email to