Skip to content

Commit 4182450

Browse files
committed
Fix import statement for Hardware in fact.py and update test_fact.py
1 parent d91e645 commit 4182450

File tree

2 files changed

+18
-13
lines changed

2 files changed

+18
-13
lines changed

ci/prodbin/Dockerfile.in

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -104,10 +104,10 @@ RUN <<EOT
104104
set -eux
105105

106106
# Install python 2 with latest security fixes from Ubuntu 22.04
107-
BASE_URL="launchpad.net/ubuntu/+archive/primary/+files/"
107+
BASE_URL="http://security.ubuntu.com/ubuntu/pool/universe/p/python2.7"
108108

109109
# Manually download libssl1.1 from Jammy as it is required for Python 2.7's _ssl module
110-
wget -c "https://${BASE_URL}/libssl1.1_1.1.1f-1ubuntu2.24_amd64.deb"
110+
wget -c "http://security.ubuntu.com/ubuntu/pool/main/o/openssl/libssl1.1_1.1.1f-1ubuntu2.24_amd64.deb"
111111
dpkg -i libssl1.1_1.1.1f-1ubuntu2.24_amd64.deb
112112
rm libssl1.1_1.1.1f-1ubuntu2.24_amd64.deb
113113

src/Products/Zing/tests/test_fact.py

Lines changed: 16 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,20 @@
1010
from __future__ import absolute_import
1111

1212
from unittest import TestCase
13-
13+
from Products.ZenModel.Device import Device
1414
from Products.ZenModel.Hardware import Hardware
1515
from Products.Zing.fact import device_info_fact, MetadataKeys
1616

17+
1718
class DummyDevice(object):
18-
id = "dummy_device"
19-
title = "Dummy Device"
19+
id = "test_device"
20+
title = "Test Device"
21+
meta_type = "Device"
22+
23+
def __init__(self):
24+
self.__class__ = Device
2025

26+
def titleOrId(self): return self.title
2127
def _propertyMap(self): return []
2228
def device(self): return None
2329
def getProductionState(self): return 1000
@@ -31,17 +37,18 @@ def getHWTag(self): return "device_hw_tag"
3137
def getHWSerialNumber(self): return "device_hw_sn"
3238

3339

34-
class DummyHardwareComponent(Hardware):
35-
id = "dummy_hw_comp"
36-
title = "Dummy HW Component"
40+
class DummyHardwareComponent(object):
41+
id = "test_hw_comp"
42+
title = "Test HW Comp"
43+
meta_type = "HWComponent"
3744

3845
tag = "comp_hw_tag"
3946
serialNumber = "comp_hw_sn"
4047

4148
def __init__(self):
42-
# Prevent calling MEProduct.__init__ which relies on ZODB infrastructure
43-
pass
49+
self.__class__ = Hardware
4450

51+
def titleOrId(self): return self.title
4552
def _propertyMap(self): return []
4653
def device(self): return None
4754
def getProductionState(self): return 1000
@@ -50,10 +57,8 @@ def getProdStateConversions(self): return {}
5057
def convertProdState(self, state): return "Production"
5158

5259
def getOSProductKey(self): return ("os_model", "os_manufacturer")
53-
54-
# Its own hardware properties
5560
def getProductKey(self): return ("comp_hw_model", "comp_hw_manufacturer")
56-
61+
5762
# Inherited device properties (fallback)
5863
def getHWProductKey(self): return ("device_hw_model", "device_hw_manufacturer")
5964
def getHWTag(self): return "device_hw_tag"

0 commit comments

Comments
 (0)