summaryrefslogtreecommitdiff
path: root/ironic_python_agent/agent.py
diff options
context:
space:
mode:
authorAlexander Gordeev <agordeev@mirantis.com>2014-05-05 15:49:03 +0400
committerAlexander Gordeev <agordeev@mirantis.com>2014-05-06 18:02:45 +0400
commited4460990e9e71994c631dde545f50005b5ef769 (patch)
tree09e1e1b085b0d24f1dbda1dd4558a927a9fc2261 /ironic_python_agent/agent.py
parentf95c8a9e6d6bb2a9c834b0bd8c4819bf25815af8 (diff)
downloadironic-python-agent-ed4460990e9e71994c631dde545f50005b5ef769.tar.gz
Make encoding.serialize() more programmatical
Introduce `serializable_fields` to express which class attributes to be serialized. Get rid of OrderedDict. Just replacing it with regular dict. Change-Id: I3f7639dab171d3d62e92d0d1bb6d7b071cf963ad
Diffstat (limited to 'ironic_python_agent/agent.py')
-rw-r--r--ironic_python_agent/agent.py10
1 files changed, 2 insertions, 8 deletions
diff --git a/ironic_python_agent/agent.py b/ironic_python_agent/agent.py
index 39c8368c..7a75f0a3 100644
--- a/ironic_python_agent/agent.py
+++ b/ironic_python_agent/agent.py
@@ -27,7 +27,6 @@ from ironic_python_agent.extensions import base
from ironic_python_agent import hardware
from ironic_python_agent import ironic_api_client
from ironic_python_agent.openstack.common import log
-from ironic_python_agent import utils
def _time():
@@ -36,17 +35,12 @@ def _time():
class IronicPythonAgentStatus(encoding.Serializable):
+ serializable_fields = ('started_at', 'version')
+
def __init__(self, started_at, version):
self.started_at = started_at
self.version = version
- def serialize(self):
- """Turn the status into a dict."""
- return utils.get_ordereddict([
- ('started_at', self.started_at),
- ('version', self.version),
- ])
-
class IronicPythonAgentHeartbeater(threading.Thread):
# If we could wait at most N seconds between heartbeats (or in case of an