Using aiven-cli to set ip_filters failing

I’m trying the set a the ip-filter(s) for a mysql database using the aiven-cli (latest version) with the following command

avn service update my-db-service -c ip_filter=10.0.0.1/24,10.0.0.2/24

But it results in the below error. I’ve tried various versions of python and still the same error, any suggestions?

Traceback (most recent call last):
File “/usr/local/bin/avn”, line 8, in
sys.exit(main())
File “/usr/local/lib/python3.10/site-packages/aiven/client/main.py”, line 6, in main
AivenCLI().main()
File “/usr/local/lib/python3.10/site-packages/aiven/client/argx.py”, line 409, in main
sys.exit(self.run(args))
File “/usr/local/lib/python3.10/site-packages/aiven/client/argx.py”, line 381, in run
return self.run_actual(args)
File “/usr/local/lib/python3.10/site-packages/aiven/client/argx.py”, line 403, in run_actual
return func()
File “/usr/local/lib/python3.10/site-packages/aiven/client/cli.py”, line 4193, in service__update
user_config = self.create_user_config(user_config_schema)
File “/usr/local/lib/python3.10/site-packages/aiven/client/cli.py”, line 229, in create_user_config
value = convert_str_to_value(opt_schema, value)
File “/usr/local/lib/python3.10/site-packages/aiven/client/cli.py”, line 66, in convert_str_to_value
evaluated_array = literal_eval(value)
File “/usr/local/lib/python3.10/ast.py”, line 64, in literal_eval
node_or_string = parse(node_or_string.lstrip(" \t"), mode=‘eval’)
File “/usr/local/lib/python3.10/ast.py”, line 50, in parse
return compile(source, filename, mode, flags,
File “”, line 1
10.0.0.1/24,10.0.0.2/24
^^
SyntaxError: invalid syntax

resolved, seems you need to provide the command in the following format

avn service update my-db-service -c ip_filter="['10.0.0.1/24','10.0.0.2/24']"

1 Like

The ip_filter parameter expects a comma-separated list of CIDR notation IP addresses. However, it seems that the way you’re passing the values might not be correct.

avn service update my-db-service -c "ip_filter=10.0.0.1/24,10.0.0.2/24"

By doing this, you’re ensuring that the entire value is treated as a single string parameter and passed correctly to the CLI without causing any syntax errors during evaluation.

Best Regard
Danish Hafeez | QA Assistant
ICTInnovations

3 Likes