compass-core/bin/chef/addcookbooks.py
xiaodongwang 7f080e4e51 fix pep8 warning and move major util code from bin to compass dir.
Change-Id: I7baa536888db1ca46cadcdf07ef9cc0a1a3a12fb
2014-02-19 22:25:45 -08:00

29 lines
593 B
Python
Executable File

#!/usr/bin/env python
"""import cookbooks to chef server."""
import logging
import os
import os.path
from compass.utils import flags
from compass.utils import logsetting
flags.add('cookbooks_dir',
help='chef cookbooks directory',
default='/var/chef/cookbooks')
def main():
"""main entry"""
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)
if __name__ == '__main__':
main()