Closed ChrisAtkinson1 closed 5 years ago
cics-deploy wont allow the user to accidentally splat something that isn't a bundle. That was a critical protection before we introduced the concept of --targetdir (just imagine the horrors of accidentally running "rm -r *" in your home directory by mistake!) But even with --targetdir it's still an important protection; it wont splat over something that isn't a Bundle.
Your remote directory isn't a Bundle, so it's correct for cics-deploy to not destroy it for you.
I guess we could issue a message suggesting a Zowe command the user could run to destroy the remote directory if they want to, but it would be very wrong for cics-deploy to do that automatically. I gather that the userid cics-deploy is running under doesn't have authority to delete the remote files anyway... so given that, I don't see that there's much we can do.
I can't delete them with my userid on the machine! And why have the node_modules been created by the previous deploy ?
node_modules
would likely have been created as a result of npm install
on a previous push bundle.
Unfortunately we're beyond anything that cics-deploy knows about. If there's a better command for emptying the file system then we could switch to use that, but we can't automate something in cics-deploy that can't be done otherwise.
Presumably there's something in those sub-directories that's problematic. Perhaps there are sub-files (potentially hidden files) for which you don't have write permission. Maybe you could issue a chmod in order to get write permission?
And additionally just to make sure I was not going nuts. This is deploy - followed by a redeploy, error occurs. This is new behaviour for me.
C:\Users\CHRISTOPHERAtkinson\Documents\ZoweStuff\ZOWEDEV\PUSH1\tests\Cicsjson\CICSJSON>zowe cics-deploy push bundle --name CICSJS02 --zosmf-profile zosmf2c --cics-deploy-profile deploy --ssh-profile ssh2Ckey --targetdir /u/atkinc/push5 PUSH operation completed.
C:\Users\CHRISTOPHERAtkinson\Documents\ZoweStuff\ZOWEDEV\PUSH1\tests\Cicsjson\CICSJSON>zowe cics-deploy push bundle --name CICSJS02 --zosmf-profile zosmf2c --cics-deploy-profile deploy --ssh-profile ssh2Ckey --targetdir /u/atkinc/push5 --ow
$ cd /u/atkinc/push5/CICSJSON_1.0.0 && rm -r rm: FSUM7283 rm: fatal error during "-r" option: EDC5129I No such file or directory. $ Command Error: A failure occurred during CICS bundle pushing. Reason = A problem occurred attempting to run 'rm -r ' in remote directory '/u/atkinc/push5/CICSJSON_1.0.0'. Problem is: The output from the remote command implied that an error occurred.
Looks like the remote rm failed.
We could script an 'npm uninstall' into the proceedings if that would help. It'll increase the elapsed time and may do nothing at all, but we could give it a go (or perhaps you could try it yourself to see if it's likely to help). Presumably there's something in the dependencies that is doing interesting things on the remote file system during install that can't be undone with a simple "rm -r *".
I found a weird behaviour. I could not delete node_modules directory as mentioned above, but if I delete the contents of the node_modules directory first then delete that directory, it worked.
/u/gb1220/bundles/sshapp_1.0.0:>ls META-INF index.js node_modules nodejsapps package-lock.json package.json /u/gb1220/bundles/sshapp_1.0.0:>rm -rf node_modules/ rm: FSUM7283 rm: fatal error during "-r" option: EDC5129I No such file or directory. /u/gb1220/bundles/sshapp_1.0.0:>rm -rf node_modules/* /u/gb1220/bundles/sshapp_1.0.0:>rm -rf node_modules /u/gb1220/bundles/sshapp_1.0.0:>ls META-INF index.js nodejsapps package-lock.json package.json
I don't know what is causing it, but this is a workaround, or we could use this command to avoid using rm -rf
.
npm uninstall `ls -1 node_modules | tr '/\n' ' '`
Yup, that's what I've implemented in #124! The pull request just needs someone to approve it...
I found npm uninstall * worked for me in the top level node_modules.
Whilst this now works - if there is no node_modules present this is printed to the console.
C:\Users\CHRISTOPHERAtkinson\Documents\ZoweStuff\ZOWEDEV\PUSH1\tests\Cicsjson\CICSJSON>zowe cics-deploy push bundle --name CICSJS02 --targetdir //u//atkinc//push6 --zosmf-profile zosmf2c --cics-deploy-profile deploy --ssh-profile ssh2Ckey --ow
<node-latest-os390-s390x/bin" && npm uninstall `ls -1 node_modules | tr '/
' ' '` ls: FSUM6785 File or directory "node_modules" is not found npm ERR! npm uninstall [@scope>/]<pkg>[@<version]... [--save|--save-dev|--save-optional] npm ERR! npm ERR! aliases: un, unlink, remove, rm, r $
<node-latest-os390-s390x/bin" && npm uninstall `ls -1 node_modules | tr '/
' ' '` ls: FSUM6785 File or directory "node_modules" is not found npm ERR! npm uninstall [@scope>/]<pkg>[@<version]... [--save|--save-dev|--save-optional] npm ERR! npm ERR! aliases: un, unlink, remove, rm, r $
<node-latest-os390-s390x/bin" && npm uninstall `ls -1 node_modules | tr '/
' ' '` ls: FSUM6785 File or directory "node_modules" is not found npm ERR! npm uninstall [@scope>/]<pkg>[@<version]... [--save|--save-dev|--save-optional] npm ERR! npm ERR! aliases: un, unlink, remove, rm, r $
<node-latest-os390-s390x/bin" && npm uninstall `ls -1 node_modules | tr '/
' ' '` ls: FSUM6785 File or directory "node_modules" is not found npm ERR! npm uninstall [@scope>/]<pkg>[@<version]... [--save|--save-dev|--save-optional] npm ERR! npm ERR! aliases: un, unlink, remove, rm, r $ PUSH operation completed.
I suggest to change the command to this:
_ if [ "$(ls node_modules)" ]; then npm uninstall `ls -1 nodemodules | tr '/\n' ' '`; fi
It checks if the directory is empty before running npm uninstall.
When I try to push with overwrite specified now I get this error.
zowe cics-deploy push bundle --name CICSJS02 --zosmf-profile zosmf2c --cics-deploy-profile deploy --ssh-profile ssh2Ckey --ow Command Error: A failure occurred during CICS bundle pushing. Reason = A problem occurred accessing remote bundle directory '/u/atkinc/pushtest2/CICSJSON_1.0.0'. Problem is: The remote directory is already populated and does not contain a bundle.
Additionally when I try to rm -rf this directory on the host shell - it fails with.
drwxr-xr-x 3 ATKINC TSOUSER 8192 May 3 10:57 CICSJSON_1.0.0 /u/atkinc/pushtest2:>rm -rf CICSJSON_1.0.0 rm: FSUM7283 rm: fatal error during "-r" option: EDC5129I No such file or directory.
even rm -rf * fails with the same error.
And this is what is inside the directory
/u/atkinc/pushtest2/CICSJSON_1.0.0:>ls -al total 48 drwxr-xr-x 3 ATKINC TSOUSER 8192 May 3 10:57 . drwxr-xr-x 3 ATKINC TSOUSER 8192 May 3 11:00 .. drwxr-xr-x 49 ATKINC TSOUSER 8192 May 2 17:23 node_modules
Which is full - I can delete all bar these ones
/u/atkinc/pushtest2/CICSJSON_1.0.0/node_modules:>ls -al
drwxr-xr-x 3 ATKINC TSOUSER 8192 May 3 10:57 accepts drwxr-xr-x 3 ATKINC TSOUSER 8192 May 3 11:02 express drwxr-xr-x 3 ATKINC TSOUSER 8192 May 3 11:02 finalhandler drwxr-xr-x 3 ATKINC TSOUSER 8192 May 3 11:02 send