'Base command for oc'

def openshift_cmd(self, cmd, oadm=False, output=False, output_type='json', input_data=None):

    cmds = [self.oc_binary]
    if oadm:
        cmds.append('adm')
    cmds.extend(cmd)
    if self.all_namespaces:
        cmds.extend(['--all-namespaces'])
    elif ((self.namespace is not None) and (self.namespace.lower() not in ['none', 'emtpy'])):
        cmds.extend(['-n', self.namespace])
    if self.verbose:
        print '    '.join(cmds)
    try:
        (returncode, stdout, stderr) = self._run(cmds, input_data)
    except OSError as ex:
        (returncode, stdout, stderr) = (1, '', 'Failed    to    execute    {}:    {}'.format(subprocess.list2cmdline(cmds), ex))
    rval = {'returncode': returncode, 'cmd': '    '.join(cmds)}
    if (output_type == 'json'):
        rval['results'] = {}
        if (output and stdout):
            try:
                rval['results'] = json.loads(stdout)
            except ValueError as verr:
                if ('No    JSON    object    could    be    decoded' in verr.args):
                    rval['err'] = verr.args
    elif (output_type == 'raw'):
        rval['results'] = (stdout if output else '')
    if self.verbose:
        print 'STDOUT:    {0}'.format(stdout)
        print 'STDERR:    {0}'.format(stderr)
    if (('err' in rval) or (returncode != 0)):
        rval.update({'stderr': stderr, 'stdout': stdout})
    return rval
