Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updated poap.py for empty user/password in tftp option #41

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 12 additions & 3 deletions nx-os/poap/poap.py
Original file line number Diff line number Diff line change
Expand Up @@ -959,13 +959,22 @@ def do_copy(source="", dest="", login_timeout=10, dest_tmp="", compact=False):
raise
else:
# Add the destination path
copy_cmd = "terminal dont-ask ; terminal password %s ; " % password
# Check if the password is empty to avoid syntax errors in the cli
if not password:
copy_cmd = "terminal dont-ask ; terminal password \'\' ; "
else:
copy_cmd = "terminal dont-ask ; terminal password %s ; " % password
if compact is True:
copy_cmd += "copy %s://%s@%s%s %s compact vrf %s" % (
protocol, user, host, source, copy_tmp, vrf)
else:
copy_cmd += "copy %s://%s@%s%s %s vrf %s" % (
protocol, user, host, source, copy_tmp, vrf)
#Check if user is empty to remove it (avoid name resolution)
if not user:
copy_cmd += "copy %s://%s%s %s vrf %s" % (
protocol, host, source, copy_tmp, vrf)
else:
copy_cmd += "copy %s://%s@%s%s %s vrf %s" % (
protocol, user, host, source, copy_tmp, vrf)
poap_log("Command is : %s" % copy_cmd)
try:
cli(copy_cmd)
Expand Down