summaryrefslogtreecommitdiffstats
path: root/roles/lib_yaml_editor/build/generate.py
diff options
context:
space:
mode:
authorKenny Woodson <kwoodson@redhat.com>2016-03-28 17:44:48 -0400
committerKenny Woodson <kwoodson@redhat.com>2016-03-30 12:19:31 -0400
commit15d730f3aec1f579dbd3cc5310264c68eb78e242 (patch)
treeb32f0efa16101b1f47d70514d7a318c46fe3d76b /roles/lib_yaml_editor/build/generate.py
parente1f6415cbcc4145402011fb4183a5dead2f22124 (diff)
downloadopenshift-15d730f3aec1f579dbd3cc5310264c68eb78e242.tar.gz
openshift-15d730f3aec1f579dbd3cc5310264c68eb78e242.tar.bz2
openshift-15d730f3aec1f579dbd3cc5310264c68eb78e242.tar.xz
openshift-15d730f3aec1f579dbd3cc5310264c68eb78e242.zip
Moving generation of ansible module side by side with module.
Diffstat (limited to 'roles/lib_yaml_editor/build/generate.py')
-rwxr-xr-xroles/lib_yaml_editor/build/generate.py42
1 files changed, 42 insertions, 0 deletions
diff --git a/roles/lib_yaml_editor/build/generate.py b/roles/lib_yaml_editor/build/generate.py
new file mode 100755
index 000000000..6521ff2c1
--- /dev/null
+++ b/roles/lib_yaml_editor/build/generate.py
@@ -0,0 +1,42 @@
+#!/usr/bin/env python
+'''
+ Generate the openshift-ansible/roles/lib_openshift_cli/library/ modules.
+'''
+
+import os
+
+# pylint: disable=anomalous-backslash-in-string
+GEN_STR = "#!usr/bin/env python\n" + \
+ "# ___ ___ _ _ ___ ___ _ _____ ___ ___\n" + \
+ "# / __| __| \| | __| _ \ /_\_ _| __| \\\n" + \
+ "# | (_ | _|| .` | _|| / / _ \| | | _|| |) |\n" + \
+ "# \___|___|_|\_|___|_|_\/_/_\_\_|_|___|___/_ _____\n" + \
+ "# | \ / _ \ | \| |/ _ \_ _| | __| \_ _|_ _|\n" + \
+ "# | |) | (_) | | .` | (_) || | | _|| |) | | | |\n" + \
+ "# |___/ \___/ |_|\_|\___/ |_| |___|___/___| |_|\n"
+
+FILES = {'yedit.py': ['src/base.py', 'src/yedit.py', 'ansible/yedit.py'],
+ }
+
+
+def main():
+ ''' combine the necessary files to create the ansible module '''
+ openshift_ansible = ('../library/')
+ for fname, parts in FILES.items():
+ with open(os.path.join(openshift_ansible, fname), 'w') as afd:
+ afd.seek(0)
+ afd.write(GEN_STR)
+ for fpart in parts:
+ with open(fpart) as pfd:
+ # first line is pylint disable so skip it
+ for idx, line in enumerate(pfd):
+ if idx == 0 and 'skip-file' in line:
+ continue
+
+ afd.write(line)
+
+
+if __name__ == '__main__':
+ main()
+
+