Skip to content

Instantly share code, notes, and snippets.

@resmo
Created January 10, 2018 13:24
Show Gist options
  • Select an option

  • Save resmo/130caa31707e529fbf01713f0cdf877c to your computer and use it in GitHub Desktop.

Select an option

Save resmo/130caa31707e529fbf01713f0cdf877c to your computer and use it in GitHub Desktop.
#!/usr/bin/python
import subprocess
import os
start_ref = "v2.4.0.0-1"
skip_list = [
'ec2_elb',
'ec2_elb_facts',
'ec2_elb_lb',
'import_playbook',
]
p = subprocess.Popen(
"git diff --name-status %s..HEAD | grep '.py' | grep lib/ansible/modules | grep '^A' | awk '{print $2}'" % start_ref,
shell=True,
stdout=subprocess.PIPE,
stderr=subprocess.STDOUT
)
header = ""
category = ""
for line in p.stdout.readlines():
module_name = os.path.basename(line).split('.')[0]
if module_name.startswith('_') or module_name in skip_list:
continue
parts = line.split('/')
if header != parts[3]:
header = parts[3]
print('\n#### ' + header.title().replace('_', ' '))
if '.' not in parts[4]:
if category != parts[4]:
category = parts[4]
print('- ' + category)
print(' * ' + module_name)
retval = p.wait()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment