~springfield-team/charms/trusty/vem/next

« back to all changes in this revision

Viewing changes to hooks/common.py

  • Committer: Shiva Prasad Rao
  • Date: 2014-12-19 18:52:31 UTC
  • Revision ID: shivrao@cisco.com-20141219185231-n1ymc5m0j7igfeg1
Addressing lint issues

Show diffs side-by-side

added added

removed removed

Lines of Context:
23
23
# Supporting functions
24
24
###############################################################################
25
25
 
26
 
#------------------------------------------------------------------------------
 
26
# ------------------------------------------------------------------------------
27
27
# get_host_specific_config: Returns the appropriate config for the desired
28
28
#                           hostname
29
29
#
30
 
#------------------------------------------------------------------------------
 
30
# ------------------------------------------------------------------------------
31
31
def get_host_specific_config(hostname):
32
32
    mapping = yaml.load(config('mapping'), Loader=yaml.loader.BaseLoader)
33
33
    print mapping
58
58
    return host_conf
59
59
 
60
60
 
61
 
#------------------------------------------------------------------------------
 
61
# ------------------------------------------------------------------------------
62
62
# update_n1kv_config: Updates the /etc/n1kv/n1kv.conf file with the latest
63
63
#                     updated values in the data.yaml
64
64
#
65
 
#------------------------------------------------------------------------------
 
65
# ------------------------------------------------------------------------------
66
66
def update_n1kv_config():
67
67
    juju_log("update_n1kv_config")
68
68
    with open('data.yaml', 'r') as f:
88
88
        subprocess.call(["vemcmd", "reread", "config"])
89
89
 
90
90
 
91
 
#------------------------------------------------------------------------------
 
91
# ------------------------------------------------------------------------------
92
92
# ifconfig: ifconfig int <int-name> <up/down>
93
93
#
94
 
#------------------------------------------------------------------------------
 
94
# ------------------------------------------------------------------------------
95
95
def ifconfig(interface, state):
96
96
    juju_log("ifconfig %s %s" % (interface, state))
97
97
    try:
100
100
        subprocess.call(['juju-log', str(e)])
101
101
 
102
102
 
103
 
#------------------------------------------------------------------------------
 
103
# ------------------------------------------------------------------------------
104
104
# enable_uplink: Enable uplink interfaces
105
105
#
106
 
#------------------------------------------------------------------------------
 
106
# ------------------------------------------------------------------------------
107
107
def enable_uplink(uplink_conf):
108
108
    uplink_conf = \
109
109
        uplink_conf.replace(', ', '\n').replace(',', '\n').split('\n')