manheim/manheim-c7n-tools

Validate step not working in version 1.4.0

ed-rw opened this issue · 2 comments

ed-rw commented

The validate step fails for all polices with an error message of check_deprecations for manheim-c7n-tools version 1.4.0.

It appears that deprecation framework added in cloud custodian version 0.9.13 wants an attribute check_deprecations added to the object passed to the validate function. Without that attribute existing, this line causes an AttributeError that is then reported as making the policy invalid.

This could possibly be viewed as an issue with cloud custodian itself, as the check_deprecations attribute may have been needed to be included as part of an empty config here.

I've fixed the issue by adding check_deprecations="yes" to the instantiation of the config for the ValidateStep here.

For others encountering this issue, you can use this invocation of the docker container to add the necessary attribute to the Config object passed to validate:

docker run -it --rm -v $(pwd):/configs --workdir /configs 
  -e "AWS_ACCESS_KEY_ID=$AWS_ACCESS_KEY_ID" \
  -e "AWS_SECRET_ACCESS_KEY=$AWS_SECRET_ACCESS_KEY" \
  -e "AWS_SESSION_TOKEN=$AWS_SESSION_TOKEN" \  
  manheim/manheim-c7n-tools:1.4.0 \
  bash -c "sed -i '/conf = Config.empty($/ s/$/check_deprecations=\"yes\",/' /manheim_c7n_tools/manheim_c7n_tools/runner.py; manheim-c7n-runner ..."

This should be resolved by #69. The latest release (1.4.1) will have the fix

ed-rw commented

Sweet! I have confirmed that using version 1.4.1 fixes this issue for us. Thanks for the quick responses @jleopold28 and @vincentclee !