Normally, RegisterVars() does not just register the supplied value in python-agentx's "cache" (by setting self[oid]), it also maintains pointers "noid" (= "next OID") to support SNMP's GetNext operation correctly.
However in this scenario it fails:
RegisterVar("a", 0)
RegisterVar("b", 1) # up to here snmpwalk shows both variables
RegisterVar("a", 2) # up to here snmpwalk shows a only
This is because RegisterVar() always assumes that a new variable is registered. We don't get duplicate entries because the underlying dictionary data type enforces unique keys, yet the last call to RegisterVar() always sets "noid" to None, even when just updating previously registered values.
Attached patch fixes this by distinguishing whether a key already exists (= variable has been registered before) or not.
Patch to make RegisterVars() register vars just once