diff --git a/services/mmc/plugins/updates/__init__.py b/services/mmc/plugins/updates/__init__.py index 6e27308ec2..176e91692e 100644 --- a/services/mmc/plugins/updates/__init__.py +++ b/services/mmc/plugins/updates/__init__.py @@ -108,7 +108,9 @@ def white_unlist_update(updateid): def get_machine_with_update(kb, updateid, uuid, start=0, limit=-1, filter=""): - result = XmppMasterDatabase().get_machine_with_update(kb, updateid, uuid, start, limit, filter, Glpi().config) + result = XmppMasterDatabase().get_machine_with_update( + kb, updateid, uuid, start, limit, filter, Glpi().config + ) return result diff --git a/services/pulse2/database/xmppmaster/__init__.py b/services/pulse2/database/xmppmaster/__init__.py index cf8a489bc7..376085f2f6 100644 --- a/services/pulse2/database/xmppmaster/__init__.py +++ b/services/pulse2/database/xmppmaster/__init__.py @@ -13242,7 +13242,9 @@ def get_conformity_update_by_machine(self, session, idmachine): return result @DatabaseHelper._sessionm - def get_machine_with_update(self, session, kb, updateid, uuid, start=0, limit=-1, filter="", config=None): + def get_machine_with_update( + self, session, kb, updateid, uuid, start=0, limit=-1, filter="", config=None + ): filter_on = "" if config is not None and config.filter_on is not None: @@ -13256,7 +13258,11 @@ def get_machine_with_update(self, session, kb, updateid, uuid, start=0, limit=-1 column = "lgf.states_id" elif key == "type": column = "lgf.computertypes_id" - filter_on = " %s AND %s in (%s) "%(filter_on, column, ",".join(config.filter_on[key])) + filter_on = " %s AND %s in (%s) " % ( + filter_on, + column, + ",".join(config.filter_on[key]), + ) try: start = int(start) except: @@ -13272,7 +13278,10 @@ def get_machine_with_update(self, session, kb, updateid, uuid, start=0, limit=-1 sfilter = "" if filter != "": - sfilter = """AND (lgm.name LIKE '%%%s%%' OR m.platform LIKE '%%%s%%')""" % tuple(filter for x in range(0, 2)) + sfilter = ( + """AND (lgm.name LIKE '%%%s%%' OR m.platform LIKE '%%%s%%')""" + % tuple(filter for x in range(0, 2)) + ) sql = """Select SQL_CALC_FOUND_ROWS lgm.id, @@ -13325,18 +13334,20 @@ def get_machine_with_update(self, session, kb, updateid, uuid, start=0, limit=-1 group by lgm.id order by name %s -"""%(updateid, uuid.replace("UUID", ""), filter_on, sfilter, kb, filter_on, sfilter, filterlimit) +""" % ( + updateid, + uuid.replace("UUID", ""), + filter_on, + sfilter, + kb, + filter_on, + sfilter, + filterlimit, + ) datas = session.execute(sql) count = session.execute("SELECT FOUND_ROWS();") - result = { - "total":0, - "datas" : { - "id":[], - "name":[], - "os":[] - } - } + result = {"total": 0, "datas": {"id": [], "name": [], "os": []}} for elem in count: result["total"] = elem[0] break