2014-01-08 19:18:04 -08:00
|
|
|
#!/usr/bin/env python
|
2014-02-18 16:09:14 -08:00
|
|
|
"""import cookbooks to chef server."""
|
2014-02-04 18:31:43 -08:00
|
|
|
import logging
|
2014-01-08 19:18:04 -08:00
|
|
|
import os
|
|
|
|
import os.path
|
|
|
|
|
2014-02-04 18:31:43 -08:00
|
|
|
|
|
|
|
from compass.utils import flags
|
|
|
|
from compass.utils import logsetting
|
|
|
|
|
|
|
|
|
|
|
|
flags.add('cookbooks_dir',
|
|
|
|
help='chef cookbooks directory',
|
|
|
|
default='/var/chef/cookbooks')
|
|
|
|
|
|
|
|
|
2014-02-18 16:09:14 -08:00
|
|
|
def main():
|
|
|
|
"""main entry"""
|
2014-02-04 18:31:43 -08:00
|
|
|
flags.init()
|
|
|
|
logsetting.init()
|
|
|
|
cookbooks_dir = flags.OPTIONS.cookbooks_dir
|
|
|
|
logging.info('add cookbooks %s', cookbooks_dir)
|
|
|
|
cmd = "knife cookbook upload --all --cookbook-path %s" % cookbooks_dir
|
|
|
|
os.system(cmd)
|
2014-01-08 19:18:04 -08:00
|
|
|
|
2014-02-18 16:09:14 -08:00
|
|
|
|
|
|
|
if __name__ == '__main__':
|
|
|
|
main()
|