arista-eosplus / ztpserver

Full service ZTP Server implementation for bootstrapping Arista EOS nodes
Other
70 stars 33 forks source link

install_image action fails to install EOS image #399

Closed getoutofmyyard closed 1 year ago

getoutofmyyard commented 1 year ago

I'm running ztpserver 2.0.0 using a Python 3.8 venv and Apache. The install_image script fails after the image is downloaded. It looks like the script is attempting to pull the file twice from different URLs: http://{ztpserver}:8080/files/images/EOS-4.29.3M.swi and http://{ztpserver}:8080/meta/files/images/EOS-4.29.3M.swi before it fails.

Sanitized output from the Arista switch:

bash-4.2# python zt-download 
...
{serial}: Downloading action install_image
{serial}: GET http://{ztpserver}:8080/actions/install_image
{serial}: Server response to GET request: status=200
{serial}: Writing /tmp/install_image...
{serial}: Executing action install_image
{serial}: STREAM http://{ztpserver}:8080/files/images/EOS-4.29.3M.swi - /mnt/flash/EOS-4.29.3M.swi
{serial}: Server response to GET request: status=200
{serial}: GET http://{ztpserver}:8080/meta/files/images/EOS-4.29.3M.swi
ERROR: {serial}: Bootstrap process failed: executing action failed (install_image): Expecting value: line 1 column 1 (char 0)

Sanitized definition file:

---
actions:
  -
    action: add_config
    always_execute: true
    attributes:
      name: "Push startup configuration to switch"
      url: nodes/{serial}/startup-config

  -
    action: install_image
    always_execute: true
    name: "Validate image"
    attributes:
      url: files/images/EOS-4.29.3M.swi
      version: 4.29.3M

Troubleshooting steps I have tried:

  1. Verified the server URL is correct in ztpserver.conf and in dhcpd.conf
  2. Verified that the image exists in files/images/
  3. Created meta/files/images/ and copied the same EOS image to that location
  4. Verified that file/directory permissions are correct
  5. Used ztps --validate to validate YAML definition file
dlobato commented 1 year ago

396 and #397 should address the reported issue.

We are about to release a new version that should fix this problem.

dlobato commented 1 year ago

@getoutofmyyard there's a new v2.0.1 release that should fix this issue

getoutofmyyard commented 1 year ago

Thanks @dlobato!