def _parse_repos(module):
 cmd = _get_cmd('--xmlout', 'repos')
 from xml.dom.minidom import parseString as parseXML
 (rc, stdout, stderr) = module.run_command(cmd, check_rc=False)
 if (rc == 0):
  repos = []
  dom = parseXML(stdout)
  repo_list = dom.getElementsByTagName('repo')
  for repo in repo_list:
   opts = {}
   for o in REPO_OPTS:
    opts[o] = repo.getAttribute(o)
   opts['url'] = repo.getElementsByTagName('url')[0].firstChild.data
   repos.append(opts)
  return repos
 elif (rc == 6):
  return []
 else:
  module.fail_json(msg=('Failed to execute "%s"' % ' '.join(cmd)), rc=rc, stdout=stdout, stderr=stderr)

def _parse_repos ( module ) : cmd = _get_cmd ( '--xmlout' , 'repos' ) from xml . dom . minidom import parseString as parseXML ( rc , stdout , stderr ) = module . run_command ( cmd , check_rc = False ) if ( rc == 0 ) : repos = [ ] dom = parseXML ( stdout ) repo_list = dom . getElementsByTagName ( 'repo' ) for repo in repo_list : opts = { } for o in REPO_OPTS : opts [ o ] = repo . getAttribute ( o ) opts [ 'url' ] = repo . getElementsByTagName ( 'url' ) [ 0 ] . firstChild . data repos . append ( opts ) return repos elif ( rc == 6 ) : return [ ] else : module . fail_json ( msg = ( 'Failed to execute "%s"' % ' ' . join ( cmd ) ) , rc = rc , stdout = stdout , stderr = stderr )
parses the output of zypper --xmlout repos and return a parse repo dictionary .