Skip to content

Commit

Permalink
update nornir_utilities for 2.x
Browse files Browse the repository at this point in the history
  • Loading branch information
Carl committed May 3, 2019
1 parent c4eb460 commit d108ef3
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 12 deletions.
10 changes: 4 additions & 6 deletions nornir/os_upgrade/part1/nornir_utilities.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,16 @@
from pprint import pprint


def nornir_set_creds(brg, username=None, password=None):
def nornir_set_creds(nr, username=None, password=None):
"""Handler so credentials don't need stored in clear in inventory."""
if not username:
username = input("Enter username: ")
if not password:
password = getpass()

for host_obj in brg.inventory.hosts.values():
# host_obj.username = username
# host_obj.password = password
host_obj.data["username"] = username
host_obj.data["password"] = password
for host_obj in nr.inventory.hosts.values():
host_obj.username = username
host_obj.password = password


def std_print(agg_result):
Expand Down
10 changes: 4 additions & 6 deletions nornir/os_upgrade/part2/nornir_utilities.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,16 @@
from pprint import pprint


def nornir_set_creds(brg, username=None, password=None):
def nornir_set_creds(nr, username=None, password=None):
"""Handler so credentials don't need stored in clear in inventory."""
if not username:
username = input("Enter username: ")
if not password:
password = getpass()

for host_obj in brg.inventory.hosts.values():
# host_obj.username = username
# host_obj.password = password
host_obj.data["username"] = username
host_obj.data["password"] = password
for host_obj in nr.inventory.hosts.values():
host_obj.username = username
host_obj.password = password


def std_print(agg_result):
Expand Down

0 comments on commit d108ef3

Please sign in to comment.