summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHarry Huang <huangxiangyu5@huawei.com>2018-10-16 16:49:54 +0800
committerHarry Huang <huangxiangyu5@huawei.com>2018-10-16 16:49:54 +0800
commit3a901b963ff7e5d56f65a3581563835da6765202 (patch)
tree4e173a293143b205dd8e00778a85bb07873fc935
parentc5a7aaf83d500ec7c4b02d4cfddaf86b85182b2c (diff)
Ignore owner_id
JIRA: - Support add machine without owner_id Change-Id: Ia47d6c4cd514ee315350b45eaa64282e15f97346 Signed-off-by: Harry Huang <huangxiangyu5@huawei.com>
-rw-r--r--compass-deck/db/api/machine.py2
-rw-r--r--compass-tasks-base/db/api/machine.py2
2 files changed, 2 insertions, 2 deletions
diff --git a/compass-deck/db/api/machine.py b/compass-deck/db/api/machine.py
index 7991ada..4222288 100644
--- a/compass-deck/db/api/machine.py
+++ b/compass-deck/db/api/machine.py
@@ -68,7 +68,7 @@ def _get_machine(machine_id, session=None, **kwargs):
@utils.input_validates(mac=utils.check_mac)
def _add_machine(mac, owner_id=None, session=None, **kwargs):
"""Add a machine."""
- if isinstance(owner_id, (int, long)):
+ if not owner_id or isinstance(owner_id, (int, long)):
return utils.add_db_object(
session, models.Machine,
True,
diff --git a/compass-tasks-base/db/api/machine.py b/compass-tasks-base/db/api/machine.py
index 7991ada..4222288 100644
--- a/compass-tasks-base/db/api/machine.py
+++ b/compass-tasks-base/db/api/machine.py
@@ -68,7 +68,7 @@ def _get_machine(machine_id, session=None, **kwargs):
@utils.input_validates(mac=utils.check_mac)
def _add_machine(mac, owner_id=None, session=None, **kwargs):
"""Add a machine."""
- if isinstance(owner_id, (int, long)):
+ if not owner_id or isinstance(owner_id, (int, long)):
return utils.add_db_object(
session, models.Machine,
True,