~chad.smith/charms/precise/postgresql/postgresql-using-storage-subordinate

« back to all changes in this revision

Viewing changes to hooks/hooks.py

  • Committer: Chad Smith
  • Date: 2014-02-10 21:39:25 UTC
  • Revision ID: chad.smith@canonical.com-20140210213925-vpjxwvp9t81u5kdp
remove unused volume_map config option from postgresql as storage will supply this

Show diffs side-by-side

added added

removed removed

Lines of Context:
15
15
import sys
16
16
from tempfile import NamedTemporaryFile
17
17
import time
18
 
import yaml
19
 
from yaml.constructor import ConstructorError
20
18
 
21
19
from charmhelpers import fetch
22
20
from charmhelpers.core import hookenv, host
109
107
        self.save()
110
108
 
111
109
 
112
 
###############################################################################
113
 
# Volume managment
114
 
###############################################################################
115
 
#------------------------------
116
 
# Get volume-id from juju config "volume_map" dictionary as
117
 
#     volume_map[JUJU_UNIT_NAME]
118
 
# @return  volid
119
 
#
120
 
#------------------------------
121
 
def volume_get_volid_from_volume_map():
122
 
    """Grab a designated volid from the configuration volume_map setting.
123
 
    This value if present will be passed the the storage subordinate in order
124
 
    to specify a preexisting volumid to mount.
125
 
    """
126
 
    volume_map = {}
127
 
    try:
128
 
        volume_map = yaml.load(hookenv.config('volume-map').strip())
129
 
        if volume_map:
130
 
            return volume_map.get(os.environ['JUJU_UNIT_NAME'])
131
 
    except ConstructorError as e:
132
 
        log("invalid YAML in 'volume-map': {}".format(e), WARNING)
133
 
    return None
134
 
 
135
 
 
136
110
def volume_get_all_mounted():
137
111
    config_data = hookenv.config()
138
112
    storage_mount_point = config_data["storage_mount_point"]
764
738
    update_repos_and_packages(config_data["version"])
765
739
 
766
740
    if mount_point is not None:
767
 
        ## config_changed_volume_apply will stop the service if it founds
 
741
        ## config_changed_volume_apply will stop the service if it finds
768
742
        ## it necessary, ie: new volume setup
769
743
        if config_changed_volume_apply(mount_point=mount_point):
770
744
            postgresql_autostart(True)