
This commit fixes the patch current implementation in Debian env. It checks the sysroot commit, feed commit and active deployment commit to report if a node is patch current or not. Test: - Build/ Bootstrap/ Unlock / Reboot and verify that patching does not trigger a reboot loop. Story: 2009969 Task: 45394 Signed-off-by: Jessica Castelino <jessica.castelino@windriver.com> Change-Id: I43c02af3c7f5b3b0430502b1c5992d6b7bcd1915
67 lines
1.9 KiB
Python
67 lines
1.9 KiB
Python
"""
|
|
Copyright (c) 2014-2017 Wind River Systems, Inc.
|
|
|
|
SPDX-License-Identifier: Apache-2.0
|
|
|
|
"""
|
|
|
|
from cgcs_patch.patch_functions import LOG
|
|
|
|
PATCHMSG_UNKNOWN = 0
|
|
PATCHMSG_HELLO = 1
|
|
PATCHMSG_HELLO_ACK = 2
|
|
PATCHMSG_SYNC_REQ = 3
|
|
PATCHMSG_SYNC_COMPLETE = 4
|
|
PATCHMSG_HELLO_AGENT = 5
|
|
PATCHMSG_HELLO_AGENT_ACK = 6
|
|
PATCHMSG_QUERY_DETAILED = 7
|
|
PATCHMSG_QUERY_DETAILED_RESP = 8
|
|
PATCHMSG_AGENT_INSTALL_REQ = 9
|
|
PATCHMSG_AGENT_INSTALL_RESP = 10
|
|
PATCHMSG_DROP_HOST_REQ = 11
|
|
PATCHMSG_SEND_LATEST_FEED_COMMIT = 12
|
|
|
|
PATCHMSG_STR = {
|
|
PATCHMSG_UNKNOWN: "unknown",
|
|
PATCHMSG_HELLO: "hello",
|
|
PATCHMSG_HELLO_ACK: "hello-ack",
|
|
PATCHMSG_SYNC_REQ: "sync-req",
|
|
PATCHMSG_SYNC_COMPLETE: "sync-complete",
|
|
PATCHMSG_HELLO_AGENT: "hello-agent",
|
|
PATCHMSG_HELLO_AGENT_ACK: "hello-agent-ack",
|
|
PATCHMSG_QUERY_DETAILED: "query-detailed",
|
|
PATCHMSG_QUERY_DETAILED_RESP: "query-detailed-resp",
|
|
PATCHMSG_AGENT_INSTALL_REQ: "agent-install-req",
|
|
PATCHMSG_AGENT_INSTALL_RESP: "agent-install-resp",
|
|
PATCHMSG_DROP_HOST_REQ: "drop-host-req",
|
|
PATCHMSG_SEND_LATEST_FEED_COMMIT: "send-latest-feed-commit",
|
|
}
|
|
|
|
|
|
class PatchMessage(object):
|
|
def __init__(self, msgtype=PATCHMSG_UNKNOWN):
|
|
self.msgtype = msgtype
|
|
self.msgversion = 1
|
|
self.message = {}
|
|
|
|
def decode(self, data):
|
|
if 'msgtype' in data:
|
|
self.msgtype = data['msgtype']
|
|
if 'msgversion' in data:
|
|
self.msgversion = data['msgversion']
|
|
|
|
def encode(self):
|
|
self.message['msgtype'] = self.msgtype
|
|
self.message['msgversion'] = self.msgversion
|
|
|
|
def data(self):
|
|
return {'msgtype': self.msgtype}
|
|
|
|
def msgtype_str(self):
|
|
if self.msgtype in PATCHMSG_STR:
|
|
return PATCHMSG_STR[self.msgtype]
|
|
return "invalid-type"
|
|
|
|
def handle(self, sock, addr): # pylint: disable=unused-argument
|
|
LOG.info("Unhandled message type: %s", self.msgtype)
|