diff options
author | baigk <baiguoku@huawei.com> | 2015-08-02 21:56:23 -0400 |
---|---|---|
committer | baigk <baiguoku@huawei.com> | 2015-08-02 22:46:09 -0400 |
commit | 79b571dae951ba9bfe36440750c1a1408b19cd69 (patch) | |
tree | e930de3f7b9bb15f5a705fcc5b13011a500e91f4 /deploy/adapters/cobbler/triggers/sync | |
parent | 9e4cf51b4b2815e90824859b52d649b6c37219d9 (diff) |
support deployment os of ubuntu 14.04 with cobbler for compass
JIRA: COMPASS-3
Change-Id: I703658b04ec7ec1df4a2a3b9eac5656419d8fd9f
Signed-off-by: baigk <baiguoku@huawei.com>
Diffstat (limited to 'deploy/adapters/cobbler/triggers/sync')
-rw-r--r-- | deploy/adapters/cobbler/triggers/sync/post/migrate_ks.py | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/deploy/adapters/cobbler/triggers/sync/post/migrate_ks.py b/deploy/adapters/cobbler/triggers/sync/post/migrate_ks.py new file mode 100644 index 00000000..ac30c532 --- /dev/null +++ b/deploy/adapters/cobbler/triggers/sync/post/migrate_ks.py @@ -0,0 +1,29 @@ +#!/usr/bin/python
+"""script to migrate rendered kickstart files from cobbler to outside."""
+import logging
+
+from cobbler import api
+
+
+def main():
+ """main entry"""
+ cobbler_api = api.BootAPI()
+ for system in cobbler_api.systems():
+ cobbler_api.kickgen.generate_kickstart_for_system(system.name)
+ try:
+ with open(
+ '/var/www/cblr_ks/%s' % system.name, 'w'
+ ) as kickstart_file:
+ logging.info("Migrating kickstart for %s", system.name)
+ data = cobbler_api.kickgen.generate_kickstart_for_system(
+ system.name)
+ kickstart_file.write(data)
+ except Exception as error:
+ logging.error("Directory /var/www/cblr_ks/ does not exist.")
+ logging.exception(error)
+ raise error
+
+
+if __name__ == '__main__':
+ logging.info("Running kickstart migration")
+ main()
|