Skip to content

"No Such File or Directory" on Cisco IOS XE router using net_put #673

Open
@JustinGrote

Description

@JustinGrote
SUMMARY

Transferring a file to a cisco router results in Initializing SCP session of remote file [bootflash:cat9k_iosxe.17.12.04.SPA.bin] for write failed with error [b'Socket error: No such file or directory'

I looked through the source code, the failure occurs when pylibssh calls the libssh.ssh_scp_init method. But, I didn't go any further. (See line 64 here: https://github.com/ansible/pylibssh/blob/devel/src/pylibsshext/scp.pyx)

Context: https://stackoverflow.com/questions/76789209/no-such-file-or-directory-error-when-using-ansibles-net-put-and-libssh-to-a

Workaround

This works fine if ansible_network_cli_ssh_type: paramiko

ISSUE TYPE
  • Bug Report
PYLISSH and LIBSSH VERSION
ansible-pylibssh             1.2.2

OS / ENVIRONMENT
ansible [core 2.17.6]
  config file = /workspaces/topco.network_automation/ansible.cfg
  configured module search path = ['/root/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/local/lib/python3.12/site-packages/ansible
  ansible collection location = /root/.ansible/collections:/usr/share/ansible/collections
  executable location = /usr/local/bin/ansible
  python version = 3.12.7 (main, Oct  1 2024, 00:00:00) [GCC 14.2.1 20240912 (Red Hat 14.2.1-3)] (/usr/bin/python3)
  jinja version = 3.1.4
  libyaml = True
STEPS TO REPRODUCE
    - name: Copy the candidate IOS image to the switch. This can take 5+ minutes for 1GB switch bundles.
      when: ios_verify.parsed.present is false
      vars:
        ansible_command_timeout: 600
      ansible.netcommon.net_put:
        src: "{{ local_image_dir }}/{{ ios_image }}"
        dest: "{{ flash_dir }}{{ ios_image }}"
        protocol: scp
        overwrite: true
EXPECTED RESULTS

File is copied

ACTUAL RESULTS
Initializing SCP session of remote file [bootflash:cat9k_iosxe.17.12.04.SPA.bin] for write failed with error [b'Socket error: No such file or directory'

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions