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!
@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!
Most helpful comment
@dwoz was able to replicate this.
Thanks for reporting.
Daniel