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
|
import toml
def modify_input(new_pipeline_path, key, value):
data = toml.load(new_pipeline_path)
pluggin = data["inputs"]["http"][0]
if key in pluggin:
#print(f"Before: {key} = {pluggin[key]}")
pluggin[key] = value
#print(f"After: {key} = {pluggin[key]}")
with open(new_pipeline_path, "w") as f:
toml.dump(data, f)
##modify_input("templates/basic_ETL.toml", "test_pipers.toml, "urls", ["stillTesting"])
## TODO
def modify_agent(new_pipeline_path, key, value):
data = toml.load(new_pipeline_path)
pluggin = data["agent"]
if key in pluggin:
#print(f"Before: {key} = {pluggin[key]}")
pluggin[key] = value
#print(f"After: {key} = {pluggin[key]}")
with open(new_pipeline_path, "w") as f:
toml.dump(data, f)
## TODO
def modify_output(new_pipeline_path, key, value):
data = toml.load(new_pipeline_path)
pluggin = data["outputs"]["influxdb"][0]
if key in pluggin:
#print(f"Before: {key} = {pluggin[key]}")
pluggin[key] = value
#print(f"After: {key} = {pluggin[key]}")
with open(new_pipeline_path, "w") as f:
toml.dump(data, f)
|