mirror of
https://gitlab.com/fabinfra/fabaccess/bffh.git
synced 2024-11-23 15:17:57 +01:00
Example actor implementation
This commit is contained in:
parent
5fdfae295a
commit
1602879e1e
@ -100,6 +100,14 @@ def on_reserve(args, actor_name, user_id):
|
|||||||
print("process called with unexpected combo id %s and state 'Reserved'" % actor_name)
|
print("process called with unexpected combo id %s and state 'Reserved'" % actor_name)
|
||||||
exit(-1)
|
exit(-1)
|
||||||
|
|
||||||
|
def on_raw(args, actor_name, data):
|
||||||
|
"""
|
||||||
|
Function called when a raw_write call was issued for the connected machine
|
||||||
|
|
||||||
|
data is the data passed with that call, base64-encoded
|
||||||
|
"""
|
||||||
|
if args.verbose > 2:
|
||||||
|
print("on_raw called! data=" + data)
|
||||||
|
|
||||||
def main(args):
|
def main(args):
|
||||||
"""
|
"""
|
||||||
@ -138,6 +146,8 @@ def main(args):
|
|||||||
on_disabled(args, args.name)
|
on_disabled(args, args.name)
|
||||||
elif new_state == "reserved":
|
elif new_state == "reserved":
|
||||||
on_reserve(args, args.name, args.userid)
|
on_reserve(args, args.name, args.userid)
|
||||||
|
elif new_state == "raw":
|
||||||
|
on_raw(args, args.name, args.data)
|
||||||
else:
|
else:
|
||||||
print("Process actor called with unknown state %s" % new_state)
|
print("Process actor called with unknown state %s" % new_state)
|
||||||
|
|
||||||
@ -175,5 +185,8 @@ if __name__ == "__main__":
|
|||||||
parser_reserved = subparsers.add_parser("reserved")
|
parser_reserved = subparsers.add_parser("reserved")
|
||||||
parser_reserved.add_argument("userid", help="The user that reserved the machine")
|
parser_reserved.add_argument("userid", help="The user that reserved the machine")
|
||||||
|
|
||||||
|
parser_raw = subparsers.add_parser("raw")
|
||||||
|
parser_raw.add_argument("data", help="Raw data set for this actor")
|
||||||
|
|
||||||
args = parser.parse_args()
|
args = parser.parse_args()
|
||||||
main(args)
|
main(args)
|
||||||
|
Loading…
Reference in New Issue
Block a user