thin-edge / robotframework-devicelibrary

MIT License
1 stars 1 forks source link

Can't rename files using `Transfer To Device` command #2

Closed Bravo555 closed 8 months ago

Bravo555 commented 1 year ago

With commands like cp or mv being able to rename files by providing a target filename, one would expect Transfer To Device to work in a similar manner. Instead, the command appears to ignore the target filename, only extract the directory, and use the source filename, resulting in the file not being renamed.

Example:

I have two keywords that attempt to transfer different files, but rename it to tedge-mosquitto.conf in the same directory:

Set up broker with server authentication
    Transfer To Device    ${CURDIR}/mosquitto-server-auth.conf    /etc/tedge/mosquitto-conf/tedge-mosquitto.conf

Set up broker with server and client authentication
    Transfer To Device    ${CURDIR}/mosquitto-client-auth.conf    /etc/tedge/mosquitto-conf/tedge-mosquitto.conf

Instead the file maintains its original filename:

$ docker exec -it edfea4f81cb33c87a6c226bf7b1066f72259d674dc734f1373e40ad59916148d bash 
$ ls /etc/tedge/mosquitto-conf/
mosquitto-server-auth.conf

The workaround is trivial (just rename the file using Execute Command after transferring), but it was a bit surprising, as there was no warning that the target filename was not expected.

reubenmiller commented 1 year ago

@Bravo555 yes the goal would be able to support that. I’ll add it to the requirements for the underlying robotframework-devicelibrary library. Copying file/s folders is deceptively more challenging that I first thought.

reubenmiller commented 8 months ago

Renaming files is now possible using Transfer To Device, though I'm not 100% sure when it was added, so to be sure use version >= 1.13.0.