~javier.collado/checkbox-core/bug991875

« back to all changes in this revision

Viewing changes to checkbox/daemon/client.py

  • Committer: Marc Tardif
  • Date: 2012-04-20 18:46:55 UTC
  • Revision ID: marc.tardif@canonical.com-20120420184655-1hl04prppvjvw8r3
Refactored Enum class to use __getitem__ instead of accessor functions.

Show diffs side-by-side

added added

removed removed

Lines of Context:
39
39
    daemon_host,
40
40
    daemon_name,
41
41
    )
42
 
from checkbox.lib.enum import (
43
 
    Enum,
44
 
    enum_value_to_name_string,
45
 
    )
 
42
from checkbox.lib.enum import Enum
46
43
from checkbox.lib.hostname import fullhostname
47
44
from checkbox.lib.net import (
48
45
    is_ipaddress,
340
337
        self._error = error % args
341
338
 
342
339
    def _getLocalName(self):
343
 
        param_name = "%s_NAME" % enum_value_to_name_string(
344
 
            ClientType, self.type)
 
340
        param_name = "%s_NAME" % ClientType[self.type]
345
341
        param_value = param.get(param_name)
346
342
        if param_value:
347
343
            return daemon_build(param_value)
360
356
            return True
361
357
 
362
358
        if not self._name and not self._pool:
363
 
            param_name = "%s_HOST" % enum_value_to_name_string(
364
 
                ClientType, self.type)
 
359
            param_name = "%s_HOST" % ClientType[self.type]
365
360
            param_value = param.get(param_name)
366
361
            if param_value:
367
362
                self._name = param_value
474
469
            self._is_local = False
475
470
 
476
471
        else:
477
 
            host = client_host_from_config(
478
 
                enum_value_to_name_string(ClientType, self.type))
 
472
            host = client_host_from_config(ClientType[self.type])
479
473
 
480
474
        if not host:
481
475
            self._setError(