def __execute_ret(command, host=None, admin_username=None, admin_password=None, module=None):
 if module:
  if (module == 'ALL'):
   modswitch = '-a '
  else:
   modswitch = '-m {0}'.format(module)
 else:
  modswitch = ''
 if (not host):
  cmd = __salt__['cmd.run_all']('racadm {0} {1}'.format(command, modswitch))
 else:
  cmd = __salt__['cmd.run_all']('racadm -r {0} -u {1} -p {2} {3} {4}'.format(host, admin_username, admin_password, command, modswitch), output_loglevel='quiet')
 if (cmd['retcode'] != 0):
  log.warning("racadm return an exit code '{0}'.".format(cmd['retcode']))
 else:
  fmtlines = []
  for l in cmd['stdout'].splitlines():
   if l.startswith('Security Alert'):
    continue
   if l.startswith('RAC1168:'):
    break
   if l.startswith('RAC1169:'):
    break
   if l.startswith('Continuing execution'):
    continue
   if (len(l.strip()) == 0):
    continue
   fmtlines.append(l)
   if ('=' in l):
    continue
  cmd['stdout'] = '\n'.join(fmtlines)
 return cmd

def __execute_ret ( command , host = None , admin_username = None , admin_password = None , module = None ) : if module : if ( module == 'ALL' ) : modswitch = '-a ' else : modswitch = '-m {0}' . format ( module ) else : modswitch = '' if ( not host ) : cmd = __salt__ [ 'cmd.run_all' ] ( 'racadm {0} {1}' . format ( command , modswitch ) ) else : cmd = __salt__ [ 'cmd.run_all' ] ( 'racadm -r {0} -u {1} -p {2} {3} {4}' . format ( host , admin_username , admin_password , command , modswitch ) , output_loglevel = 'quiet' ) if ( cmd [ 'retcode' ] != 0 ) : log . warning ( "racadm return an exit code '{0}'." . format ( cmd [ 'retcode' ] ) ) else : fmtlines = [ ] for l in cmd [ 'stdout' ] . splitlines ( ) : if l . startswith ( 'Security Alert' ) : continue if l . startswith ( 'RAC1168:' ) : break if l . startswith ( 'RAC1169:' ) : break if l . startswith ( 'Continuing execution' ) : continue if ( len ( l . strip ( ) ) == 0 ) : continue fmtlines . append ( l ) if ( '=' in l ) : continue cmd [ 'stdout' ] = '\n' . join ( fmtlines ) return cmd
execute rac commands .