-
Notifications
You must be signed in to change notification settings - Fork 34
/
scrub.py
38 lines (31 loc) · 1.25 KB
/
scrub.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
26
27
28
29
30
31
32
33
34
35
36
37
38
#!/usr/bin/env python
import sys
import json
import client as client
DRY_RUN = False
def _del(t, eid):
if not DRY_RUN:
client.delete_entity(t, eid)
def delete_entities(t):
r = client.get_entity(t)
for feature in r:
if feature['appId'] == 6245718179446784:
eid = feature['id']
group_name = feature['group']['name']
name = feature['name']
created_by = feature['createdByUser']['username']
last_updated_by = feature['lastUpdatedByUser']['username']
kind = feature['kind']
if group_name.startswith('_'):
if 'manual' not in name:
print('Removing ({}) {} [{}] created by:{}, last updated by:{}'.format(kind, eid, name, created_by, last_updated_by))
_del(t, eid)
if len(sys.argv) > 1:
if sys.argv[1] == '--dry-run':
DRY_RUN=True
if not DRY_RUN:
print('Scrubbing live data, if you want to debug, add --dry-run')
delete_entities('feature')
delete_entities('page')