summaryrefslogtreecommitdiff
path: root/modules/telegraf/telegraf_utils.py
blob: d6ed3763363369fb30ae0b8f940574c29b3e7e93 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
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"])