Excerpts from Shawn Doherty's message of 2017-07-14 09:17 -04:00:
> Hello all.. apologies if zombie thread is inappropriate but I'd like toMight be easier to read this if you post it to Gerrit. There is no harm
> revisit this conversation regarding firmware information being included.
>
> We have started a patch to display firmware and date and are hoping to get
> some input on progressing. What we were last discussing was to update the
> device table. I'm also curious about a migration script. Here is what we
> have so far.
>
>
> Thanks for looking. Shawn.
in posting a WIP or draft patch to Gerrit and asking for reviews on
there.
You'll want to fix the column name and title on these. Name can be
> diff --git a/Server/bkr/server/controllers.py
> b/Server/bkr/server/controllers.py
> index cece8db..32dc0d4 100644
> --- a/Server/bkr/server/controllers.py
> +++ b/Server/bkr/server/controllers.py
> @@ -123,9 +123,11 @@ def default(self, *args, **kw):
> widgets.PaginateDataGrid.Column(name='driver',
> getter=lambda x: x.driver, title='Driver', options=dict(sortable=True)),
> widgets.PaginateDataGrid.Column(name='vendor_id',
> getter=lambda x: x.vendor_id, title='Vendor ID',
> options=dict(sortable=True)),
> widgets.PaginateDataGrid.Column(name='device_id',
> getter=lambda x: x.device_id, title='Device ID',
> options=dict(sortable=True)),
> -
> widgets.PaginateDataGrid.Column(name='subsys_vendor_id' , getter=lambda x:
> x.subsys_vendor_id, title='Subsys Vendor ID', options=dict(sortable=True)),
> + widgets.PaginateDataGrid.Column(name='subsys_vendor_id' ,
> getter=lambda x: x.subsys_vendor_id, title='Subsys Vendor ID',
> options=dict(sortable=True)),
>
> widgets.PaginateDataGrid.Column(name='subsys_device_id' , getter=lambda x:
> x.subsys_device_id, title='Subsys Device ID', options=dict(sortable=True)),
> - ])
> +
> widgets.PaginateDataGrid.Column(name='subsys_device_id' , getter=lambda x:
> x.fw_version, title='Firmware Version', options=dict(sortable=True)),
> ++
> widgets.PaginateDataGrid.Column(name='subsys_device_id' , getter=lambda x:
> x.fw_date, title='Firmware Date', options=dict(sortable=True)),
> + ])
anything but by convention it should match the db column. It's used for
sorting inside the widget.
It looks like these are new columns on System, but they should actually
> return dict(title="Devices",
> grid = devices_grid,
> search_bar=None,
> diff --git a/Server/bkr/server/model/inventory.py
> b/Server/bkr/server/model/inventory.py
> index ecbc073..88301ae 100644
> --- a/Server/bkr/server/model/inventory.py
> +++ b/Server/bkr/server/model/inventory.py
> @@ -297,6 +297,8 @@ class System(DeclarativeMappedObject, ActivityMixin):
> kernel_type_id = Column(Integer, ForeignKey('kernel_type.id'),
> default=select([KernelType.id],
> limit=1).where(KernelType.kernel_type==u'default'). correlate(None),
> nullable=False)
> + fw_version = Column(String(32))
> + fw_date = Column(DateTime, default=None)
> kernel_type = relationship('KernelType')
> devices = relationship('Device', secondary=system_device_map,
> back_populates='systems')
be new columns on Device, right?
... oh never mind, they are here too. :-) So I guess just remove the
> @@ -2362,6 +2371,8 @@ class Device(DeclarativeMappedObject):
> device_class = relationship(DeviceClass)
> date_added = Column(DateTime, default=datetime.utcnow, nullable=False)
> systems = relationship(System, secondary=system_device_map,
> back_populates='devices')
> + fw_version = Column(String(32))
> + fw_date = Column(DateTime, default=None)
ones above on System.
We probably want Date not Datetime as the type for the fw_date column (I
assume no firmware reports its build date down to the second).
Is 32 chars enough for the version string? We can always expand it
later. Does lshw itself have any length limits/expectations for the
firmware version?
I guess this is not quite the right place... There is a loop starting
> diff --git a/systemscan/main.py b/systemscan/main.py
> index 64b9312..41895f2 100755
> --- a/systemscan/main.py
> +++ b/systemscan/main.py
> @@ -286,6 +286,14 @@ def read_inventory(inventory, arch = None,
> proc_cpuinfo='/proc/cpuinfo'):
>
> #Break the xml into the relevant sets of data
> cpuinfo = inventory.xpath(".//node[@class='processor']")[0]
> +
> + #system firmware info
> + sysfwinfo = inventory.xpath('.//node[@id="firmware"]')[0]
> + #create dictionary with key-values for version and date
> + SystemFirmware = dict(version = sysfwinfo.findtext('version'), date =
> sysfwinfo.findtext('date'))
> + #add to data
> + data['SystemFirmware'] = SystemFirmware
> +
line 492:
for device in devices:
where it compiles the list of devices with the properties for each one.
I guess you would just fill in fw_version and fw_date there, whenever
the values exist.
--
Dan Callaghan <dcallagh@redhat.com>
Senior Software Engineer, Products & Technologies Operations
Red Hat
_______________________________________________
Beaker-devel mailing list -- beaker-devel@lists.fedorahosted.org
To unsubscribe send an email to beaker-devel-leave@lists.fedorahosted.org