summaryrefslogtreecommitdiff
path: root/monitor/josef_lib.py
diff options
context:
space:
mode:
Diffstat (limited to 'monitor/josef_lib.py')
-rw-r--r--monitor/josef_lib.py22
1 files changed, 22 insertions, 0 deletions
diff --git a/monitor/josef_lib.py b/monitor/josef_lib.py
index f401b2c..46a0eee 100644
--- a/monitor/josef_lib.py
+++ b/monitor/josef_lib.py
@@ -23,6 +23,28 @@ from Crypto.Hash import SHA256
import Crypto.PublicKey.RSA as RSA
from Crypto.Signature import PKCS1_v1_5
+
+def prompt_confirm(msg = "", default = True):
+ print msg
+
+ while True:
+ if default:
+ print "Are you sure? (Y/n)"
+ else:
+ print "Are you sure? (y/N)"
+
+ import sys
+ data = sys.stdin.readline()
+
+ if data == "y\n":
+ return True
+ elif data == "n\n":
+ return False
+ elif data == "\n":
+ return default
+ else:
+ print "Answer either y or n"
+
def time_str(ts = None):
if ts is None:
return datetime.datetime.utcnow().strftime('%Y-%m-%d %H:%M:%S')