Salt: file.copy can not work on Mapped disk

Created on 23 Feb 2018  路  7Comments  路  Source: saltstack/salt

when I try to copy file from one Mapped disk to another on minion by file.copy. a problem occured to me:

[root@salt131 ~]# salt 'wanglunjia' file.copy "Z://cli" "Z://demo3" recurse=True
wanglunjia:
ERROR: No such file or directory 'Z://cli'

but if I use file.copy not from Mapped disk such as 'C://cli', the result is true
[root@salt131 ~]# salt 'wanglunjia' file.copy "D://test//nihao" "D://test2" recurse=True
wanglunjia:
True

so I try to look about source code in file.py module , I find the error is located at
src = os.path.expanduser(src) dst = os.path.expanduser(dst) if not os.path.isabs(src): raise SaltInvocationError('File path must be absolute.') if not os.path.exists(src): raise CommandExecutionError('No such file or directory \'{0}\''.format(src)) if not salt.utils.is_windows():

but I use the method 'os.path.exists("z://cli")' in C:\salt\bin\python.exe, the result show true
I don't know why ?

So if you had occured same problem, please tell me the reason or solution.

Thank you!

Bug Confirmed Platform TEAM Platform Windows severity-medium team-windows

Most helpful comment

@dwoz was able to replicate this.

Thanks for reporting.

Daniel

All 7 comments

@dwoz was able to replicate this.

Thanks for reporting.

Daniel

@gtmanfred After many test, I solved the problem;the step below:
1,stop the salt-minion service in Task Manager (the service is created by nssm);
2.start salt-minion process by salt-minion.bat;
then the problem was solved;

But I don't know why? because the salt-minion service can work on local disk but not on Mapped disk.

Thanks!

@dwoz can you try to replicate this, just to confirm that this is working?

Thanks,
Daniel

Isn't this normal, since drive Z probably isn't mapped for the same user which is running the minion service? Easiest way to tell, just try to list the contents.

# salt wanglunjia cmd.run "dir Z:"

I imagine this will fail.

but I use the method 'os.path.exists("z://cli")' in C:\salt\bin\python.exe, the result show true
I don't know why ?

@SwinBlackSea I imagine the drive is mapped for your account, so when your account is the user running python.exe, there is no issue.

@morganwillcock Thanks for your reply. you are right,if I start salt-minion by process, I can list Z: contents by salt 'wanglunjia' cmd.run "dir Z:",but no contents by service .so maybe the key is the account of python.exe and minionservice not different

I think this can be probably be closed as expected behaviour...
ping @gtmanfred

can do, thanks!

Was this page helpful?
0 / 5 - 0 ratings