diff --git a/client/alert.py b/client/alert.py new file mode 100755 index 0000000..b2190ed --- /dev/null +++ b/client/alert.py @@ -0,0 +1,43 @@ +#!/usr/bin/python3 + +import argparse +import sys +import time + + +parser = argparse.ArgumentParser(description='iconograph wait_for_service') +parser.add_argument( + '--type', + dest='type', + action='store', + choices={'happy', 'angry'}, + required=True) +FLAGS = parser.parse_args() + + +def Happy(): + yield '\a' + time.sleep(3.0) + + +def Angry(): + yield '\a' + time.sleep(0.2) + + +_TYPES = { + 'happy': Happy, + 'angry': Angry, +} + + +def main(): + handler = _TYPES[FLAGS.type] + while True: + for item in handler(): + sys.stdout.write(item) + sys.stdout.flush() + + +if __name__ == '__main__': + main() diff --git a/server/modules/autoimage.py b/server/modules/autoimage.py index b5af7e5..16f3547 100755 --- a/server/modules/autoimage.py +++ b/server/modules/autoimage.py @@ -86,6 +86,8 @@ script echo "==================" >/dev/tty7 echo "autoimage complete" >/dev/tty7 echo "==================" >/dev/tty7 + + /autoimage/client/alert.py --type=happy /dev/tty7 end script """ % { 'host': parsed.hostname,