chaostoolkit / chaostoolkit-lib

The Chaos Toolkit core library
https://chaostoolkit.org/
Apache License 2.0
77 stars 46 forks source link

Use dynamic config more then once, use the dynamic config as an argument to some other dynamic config doesn't working #250

Closed roeiK-wix closed 2 years ago

roeiK-wix commented 2 years ago

Describe the bug The issue is that we want to use the configuration that is already set the next dynamic config as an argument. Right now, we are passing the old config that is never changing, but if we will pass conf it will change dynamically and can be use to the next dynamic config.

Let see some example then: I got two dynamic config, one is setting param_1 and the other is setting param_2. I want to use param_1 for latter use in the dynamic config as an arg to the second dynamic config

“param_1”: {
      “name”: “dynamic 1”,
      “type”: “probe”,
      “provider”: {
        “type”: “python”,
        “module”: “src.some_probe”,
        “func”: “probe1",
        “arguments”: {
          “some_arg”: “${arg_1}“,
        }
      }
    }
“param_2”: {
      “name”: “dynamic 2”,
      “type”: “probe”,
      “provider”: {
        “type”: “python”,
        “module”: “src.some_probe”,
        “func”: “probe2",
        “arguments”: {
          “some_arg”: “${param_1}“, // <-- use this from the dynamic above
        }
      }
    }

Runtime versions Please run:

$ python --version
Python 3.8.1

$ chaos info core
NAME                VERSION   
CLI                 1.11.0    
Core library        1.25.0 

$ chaos info extensions
NAME                                    VERSION   LICENSE                       DESCRIPTION                                       
chaostoolkit-addons                     0.2.1.dev4+ge555e73UNKNOWN                       Addons for your Chaos Toolkit experiments  

To Reproduce Steps to reproduce the behavior. Try to use dynamic config and pass the set config to some other dynamic config.

Expected behavior A clear and concise description of what you expected to happen. The second dynamic config will be set to the return value of the probe and can be used.

Additional context Add any other context about the problem here. I think that all you got to do is to change output = run_activity(value, config, secrets) -> output = run_activity(value, conf, secrets) config to be conf in the dynamic_configuration function in the configuration.py file.