A simple wrapper script for oc binary that:
- Logs all calls to a log file
- Intercept any
deletecommand, show a--dry-run=clientoutput of the delete command and get a confirmation before executing the actual delete command.
To install this wrapper script:
-
Clone this repository and cd into the repository directory:
# git clone https://github.com/kxr/oc-wrapper # cd oc-wrapper -
Create a log file and mark it writable as all users. For example:
# sudo touch /var/log/oc.log # sudo chmod 666 /var/log/oc.log -
Set the log file in the wrapper script (oc) present in this repositry. For example:
# vim ./oc ... LOGFILE="/var/log/oc.log" ... -
Move the original
ocbinary to any location that is not inPATH. For example:# mv $(which oc) /opt/ -
At this point
occommand should not work. For example:# oc bash: oc: command not found... -
Set the location of the original
ocbinary in the wrapper script (oc) present in this repository. For example:# vim ./oc ... OC_CMD="/opt/oc" ... -
Place the
ocwrapper script present in this repository in a location that is inPATH. For example:cp ./oc /usr/bin/ chmod +x /usr/bin/oc