~cf-charmers/charms/trusty/cf-cloud-controller/trunk

« back to all changes in this revision

Viewing changes to hooks/charmhelpers/contrib/cloudfoundry/update_helpers.py

  • Committer: Al. Lomov
  • Date: 2014-04-03 08:50:52 UTC
  • Revision ID: lomov.as@gmail.com-20140403085052-0zd8s40oc4pa6bh0
return to revision 7

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#!/usr/bin/python
 
2
 
 
3
import os
 
4
import glob
 
5
import shutil
 
6
import inspect
 
7
# script filename (usually with path)
 
8
current_file = inspect.getfile(inspect.currentframe())
 
9
current_folder = os.path.dirname(os.path.abspath(current_file))
 
10
os.chdir(current_folder)
 
11
 
 
12
charms_folders = glob.glob('../charms/trusty/*')
 
13
helper_utils = ['update_helpers.py', 'update_hosts.py',
 
14
                'update_domain.py', 'azure/add-cf-ports.py']
 
15
 
 
16
# XXX: we may want to replace this process with
 
17
# a git submodule. The downside to that is that the charms
 
18
# as pulled directly from github would need an additional step
 
19
# to be complete
 
20
for charm_folder in charms_folders:
 
21
    charm_helper_folder = os.path.join(charm_folder, 'hooks', 'helpers')
 
22
    if os.path.exists(charm_helper_folder):
 
23
        shutil.rmtree(charm_helper_folder)
 
24
    print "Copying helpers to %s." % charm_helper_folder
 
25
    shutil.copytree(current_folder, charm_helper_folder)
 
26
    for util_file in helper_utils:
 
27
        os.remove(os.path.join(charm_helper_folder, util_file))