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

sw.install giving parse error when running on windows system #1206

Closed
Aaron-MJohn opened this issue Aug 30, 2022 · 3 comments
Closed

sw.install giving parse error when running on windows system #1206

Aaron-MJohn opened this issue Aug 30, 2022 · 3 comments
Assignees

Comments

@Aaron-MJohn
Copy link

Getting this error when running this code on windows system but works on Linux system.

ok, msg = sw.install(
                        package=firmware_file,
                        progress=True,
                        no_copy=False,
                        validate=False,
                        cleanfs=True,
                    )

where firmware_file is file path to the firmware on the host system.

fetch-secure: C:\Users\****\Desktop\****\network_switch_tool\ex2300-c\junos-arm-32-20.2R3-S3.6.tgz: parse error ERROR: Cannot fetch file: C:\Users\****\Desktop\****\network_switch_tool\ex2300-c\junos-arm-32-20.2R3-S3.6.tgz

@chidanandpujar chidanandpujar self-assigned this Sep 2, 2022
@chidanandpujar
Copy link
Collaborator

chidanandpujar commented Nov 23, 2022

Hi ,

Thanks for reporting this issue ,

issue looks to be related to urlparase of C:\Users*\Desktop*\network_switch_tool\ex2300-c\junos-arm-32-20.2R3-S3.6.tgz , considers it as remote url since it contains C: , ignores the no_copy=False and the pkg file is not copied to the device and directly tries to download from the remote-url and fails with error .

923  ->             for pkg in pkg_set:
924                     parsed_url = urlparse(pkg)
925                     if parsed_url.scheme == "":


from jnpr.junos import Device
from xml.etree import ElementTree as etree
from pprint import pprint
from jnpr.junos.utils.sw import SW


dev = Device(host='xx.xx.xx.xx', user='xyz', password='xyz', gather_facts=False, port=22)
dev.open()

def myprogress(dev, report):
        print("host: {}, report: {}".format( dev.hostname, report))

pkg = r"C:\Users\xxxxxxx\Downloads\junos-x86-64-20.2R3-S3.6.tgz"

sw = SW(dev)
ok, msg = sw.install(package=pkg, validate=True, remote_path='/var/tmp', progress=myprogress, no_copy=False, force_host=False, reboot=True, issu=False, release='20.2R3-S3.6', cleanfs=False, vmhost=False,parallel=True, timeout=4000)
if ok:
   sw.reboot()

Thanks & Regards
Chidanand

@Aaron-MJohn
Copy link
Author

Thanks you.
My current solution is scp the file and update it from locally from the switch.

chidanandpujar added a commit to chidanandpujar/py-junos-eznc that referenced this issue Apr 3, 2023
chidanandpujar added a commit to chidanandpujar/py-junos-eznc that referenced this issue Apr 4, 2023
chidanandpujar added a commit to chidanandpujar/py-junos-eznc that referenced this issue Apr 5, 2023
@chidanandpujar
Copy link
Collaborator

Fixed and merged via #1242

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants