-
Notifications
You must be signed in to change notification settings - Fork 112
Expand file tree
/
Copy pathmock.py
More file actions
68 lines (43 loc) · 1.33 KB
/
mock.py
File metadata and controls
68 lines (43 loc) · 1.33 KB
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
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
from __future__ import unicode_literals
import json
import os
from deis import settings
def configure_node(node):
config = {}
config['config'] = config
config['node_id'] = node.id
config['layer_id'] = node.layer.id
return config
def bootstrap_node(node):
return node
def converge_node(node):
return '', 0
def destroy_node(node):
return node
def destroy_formation(formation):
return formation
def converge_controller():
return None
def publish_user(username, data):
path = os.path.join(settings.TEMPDIR, 'user-{}'.format(username))
with open(path, 'w') as f:
f.write(json.dumps(data))
return username
def publish_app(app_id, data):
path = os.path.join(settings.TEMPDIR, 'app-{}'.format(app_id))
with open(path, 'w') as f:
f.write(json.dumps(data))
return app_id
def purge_app(app_id):
path = os.path.join(settings.TEMPDIR, 'app-{}'.format(app_id))
os.remove(path)
return app_id
def publish_formation(formation_id, data):
path = os.path.join(settings.TEMPDIR, 'formation-{}'.format(formation_id))
with open(path, 'w') as f:
f.write(json.dumps(data))
return formation_id
def purge_formation(formation_id):
path = os.path.join(settings.TEMPDIR, 'formation-{}'.format(formation_id))
os.remove(path)
return formation_id