Revision 45317e3a lib/qlang.py

b/lib/qlang.py
38 38
import pyparsing as pyp
39 39

  
40 40
from ganeti import errors
41
from ganeti import netutils
42 41
from ganeti import utils
43 42
from ganeti import compat
44 43

  
......
258 257
                                       " '%s': %s" % (text, err), err)
259 258

  
260 259

  
261
def _IsHostname(text):
262
  """Checks if a string could be a hostname.
263

  
264
  @rtype: bool
265

  
266
  """
267
  try:
268
    netutils.Hostname.GetNormalizedName(text)
269
  except errors.OpPrereqError:
270
    return False
271
  else:
272
    return True
273

  
274

  
275 260
def _CheckFilter(text):
276 261
  """CHecks if a string could be a filter.
277 262

  

Also available in: Unified diff