-
Notifications
You must be signed in to change notification settings - Fork 1
/
test.py
25 lines (20 loc) · 953 Bytes
/
test.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
#!/usr/bin/env python
# Production Imports
import sys
sys.path.append('/usr/lib/yum-plugins')
from mark import markDeploymentWrap
# Imports for testing only
import json
import random
# import inspect
@markDeploymentWrap("https://rpm.newrelic.com/deployments.xml", "<YOUR API KEY>", "<YOUR APP ID>", "<LOG STRING>", "<DEPLOY MESSAGE>", "<REVISION>", "<USERNAME>")
def testMarkDeployment(somearg):
print("Performing some action and randomly selecting success or failure")
results = [{'status': 'Error: Failure in action foo', 'data': somearg},
{'status': 'Success: Action find planet-X succeeded', 'data': somearg},
{'nostatus': 'Test with no status at all, perhaps an exception', 'data': somearg}]
return random.choice(results)
if __name__ == "__main__":
resp = testMarkDeployment('Python Rules')
# print(inspect.getmembers(resp['markresp'], predicate=inspect.ismethod))
print(json.dumps(resp))