austincunningham/change_oc

Issue when /usr/bin/oc does not exist

Closed this issue · 3 comments

Getting the following error when trying to run change_oc:

======================== Check for OC Version Installed =============================
The folowing versions of oc are installed at /opt/openshift
find: ‘/usr/bin/oc’: No such file or directory
child_process.js:669
    throw err;
    ^

Error: Command failed: sudo find /usr/bin/oc -type l -delete
find: ‘/usr/bin/oc’: No such file or directory

    at checkExecSyncError (child_process.js:629:11)
    at execSync (child_process.js:666:13)
    at Object.<anonymous> (/usr/lib/node_modules/change_oc/index.js:15:3)
    at Module._compile (internal/modules/cjs/loader.js:776:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:787:10)
    at Module.load (internal/modules/cjs/loader.js:653:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:593:12)
    at Function.Module._load (internal/modules/cjs/loader.js:585:3)
    at Function.Module.runMain (internal/modules/cjs/loader.js:829:12)
    at startup (internal/bootstrap/node.js:283:19)

Thanks ,
this line

execsync('sudo find /usr/bin/oc -type l -delete');

was added as fs.existsSync fails to detect sym linked files, if a sym linke file exists it would cause the touch to fail on line
execsync('sudo touch /usr/bin/oc');

But the issue is that if no sym linked file exists this command fails

sudo find /usr/bin/oc -type l -delete

Which is the case on first install

👍