manheim / manheim-c7n-tools

Manheim's Cloud Custodian (c7n) wrapper package, policy generator, runner, and supporting tools.
https://manheim-c7n-tools.readthedocs.io/
Apache License 2.0
45 stars 25 forks source link

if policy_source_paths is specified, include the policy sources in policies.rst #32

Closed jantman closed 4 years ago

jantman commented 4 years ago

Description

policygen generates an RST file listing each policy, its description (comment), and which accounts and regions it runs in. This does not, however, take into account the policy layering provided by policy_source_paths.

After this PR, if policy_source_paths is specified and non-empty, the policies.rst file generated by policygen will include an additional Source Path(s) column showing which source paths each policy came from.

Testing Done

Master or no policy_source_paths

+-----------------------------------------------+--------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------+
| Policy Name                                   | Account(s) / Region(s)   | Description/Comment                                                                                                                             |
+===============================================+==========================+=================================================================================================================================================+
| ami-old-used-report                           |                          | Report on old AMIs that are being used                                                                                                          |
+-----------------------------------------------+--------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------+
| asg-ec2-tag-compliance                        |                          | Report on ASG EC2 Instances missing required tags                                                                                               |
+-----------------------------------------------+--------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------+
| asg-inactive-delete                           |                          | DATA COLLECTION ONLY - Delete marked empty ASGs with old Launch Configs.                                                                        |
+-----------------------------------------------+--------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------+
| ec2-low-utilization-mark                      |                          | EC2 Instances with low utilization (in any AZ) - notify via email and mark to terminate in 14 days. Look at 2 days worth of data.               |
+-----------------------------------------------+--------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------+

This branch

+-----------------------------------------------+--------------------------+-------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------+
| Policy Name                                   | Account(s) / Region(s)   | Source Path(s)                            | Description/Comment                                                                                                                             |
+===============================================+==========================+===========================================+=================================================================================================================================================+
| ami-old-used-report                           |                          | custodian-man-common                      | Report on old AMIs that are being used                                                                                                          |
+-----------------------------------------------+--------------------------+-------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------+
| asg-ec2-tag-compliance                        |                          | custodian-man-legacy                      | Report on ASG EC2 Instances missing required tags                                                                                               |
+-----------------------------------------------+--------------------------+-------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------+
| asg-inactive-delete                           |                          | custodian-man-dev                         | DATA COLLECTION ONLY - Delete marked empty ASGs with old Launch Configs.                                                                        |
+-----------------------------------------------+--------------------------+-------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------+
| ec2-low-utilization-mark                      |                          | custodian-man-common custodian-man-legacy | EC2 Instances with low utilization (in any AZ) - notify via email and mark to terminate in 14 days. Look at 2 days worth of data.               |
+-----------------------------------------------+--------------------------+-------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------+
codecov-io commented 4 years ago

Codecov Report

Merging #32 into master will increase coverage by 0.47%. The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master      #32      +/-   ##
==========================================
+ Coverage   59.93%   60.40%   +0.47%     
==========================================
  Files           8        8              
  Lines        1263     1278      +15     
  Branches      234      238       +4     
==========================================
+ Hits          757      772      +15     
  Misses        506      506              
Impacted Files Coverage Δ
manheim_c7n_tools/policygen.py 100.00% <100.00%> (ø)
manheim_c7n_tools/version.py 100.00% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update 209e50e...a65de12. Read the comment docs.