From 18888db6f6ad674e1b5571122d3f40e0b0a227b8 Mon Sep 17 00:00:00 2001 From: Milo Casagrande Date: Fri, 21 Nov 2014 10:05:23 +0100 Subject: boot: Add new model fields. Change-Id: If176cb85f2400c2aea94088310240231985845da --- app/models/boot.py | 37 +++++++++++++++++++++++++++++++++++++ app/models/tests/test_boot_model.py | 8 +++++++- 2 files changed, 44 insertions(+), 1 deletion(-) (limited to 'app/models') diff --git a/app/models/boot.py b/app/models/boot.py index 257724e..60eeb24 100644 --- a/app/models/boot.py +++ b/app/models/boot.py @@ -76,10 +76,14 @@ class BootDocument(modb.BaseDocument): self._boot_result_description = None self._retries = 0 self._version = None + self._fastboot_cmd = None self._git_commit = None self._git_branch = None self._git_describe = None + self._git_url = None + + self._arch = None @property def collection(self): @@ -402,8 +406,39 @@ class BootDocument(modb.BaseDocument): """Set the git describe value.""" self._git_describe = value + @property + def git_url(self): + """The URL of the git repository.""" + return self._git_url + + @git_url.setter + def git_url(self, value): + """Set the URL of the git repository.""" + self._git_url = value + + @property + def fastboot_cmd(self): + """The fastboot command used.""" + return self._fastboot_cmd + + @fastboot_cmd.setter + def fastboot_cmd(self, value): + """Set the fastboot command used.""" + self._fastboot_cmd = value + + @property + def arch(self): + """The architecture of this board.""" + return self._arch + + @arch.setter + def arch(self, value): + """Set the board architecture.""" + self._arch = value + def to_dict(self): boot_dict = { + models.ARCHITECTURE_KEY: self.arch, models.BOARD_KEY: self.board, models.BOOT_LOG_HTML_KEY: self.boot_log_html, models.BOOT_LOG_KEY: self.boot_log, @@ -415,10 +450,12 @@ class BootDocument(modb.BaseDocument): models.DTB_APPEND_KEY: self.dtb_append, models.DTB_KEY: self.dtb, models.ENDIANNESS_KEY: self.endianness, + models.FASTBOOT_CMD_KEY: self.fastboot_cmd, models.FASTBOOT_KEY: self.fastboot, models.GIT_BRANCH_KEY: self.git_branch, models.GIT_COMMIT_KEY: self.git_commit, models.GIT_DESCRIBE_KEY: self.git_describe, + models.GIT_URL_KEY: self.git_url, models.INITRD_ADDR_KEY: self.initrd_addr, models.JOB_ID_KEY: self.job_id, models.JOB_KEY: self.job, diff --git a/app/models/tests/test_boot_model.py b/app/models/tests/test_boot_model.py index effbc0f..a50790e 100644 --- a/app/models/tests/test_boot_model.py +++ b/app/models/tests/test_boot_model.py @@ -43,6 +43,9 @@ class TestBootModel(unittest.TestCase): boot_doc.git_branch = "git-branch" boot_doc.git_commit = "git-commit" boot_doc.git_describe = "git-describe" + boot_doc.git_url = "git-url" + boot_doc.arch = "arm" + boot_doc.fastboot_cmd = "fastboot" expected = { '_id': 'id', @@ -74,7 +77,10 @@ class TestBootModel(unittest.TestCase): 'warnings': 2, "git_commit": "git-commit", "git_branch": "git-branch", - "git_describe": "git-describe" + "git_describe": "git-describe", + "git_url": "git-url", + "arch": "arm", + "fastboot_cmd": "fastboot" } self.assertDictEqual(expected, boot_doc.to_dict()) -- cgit v1.2.3