~heut2008/charms/trusty/keystone/ldap-support-backend

« back to all changes in this revision

Viewing changes to hooks/charmhelpers/core/host.py

  • Committer: James Page
  • Date: 2014-04-16 08:20:08 UTC
  • mfrom: (52.2.30 keystone)
  • Revision ID: james.page@canonical.com-20140416082008-34w0nyak0y571tfp
[james-page,ivoks,hazmat,yolanda.robla,r=james-page,t=*]

Redux to used charm helpers
Support for Icehouse on 12.04 and 14.04
Support for Active/Active and SSL RabbitMQ
Support for SSL MySQL
Support for SSL endpoints
Support for PostgreSQL

Show diffs side-by-side

added added

removed removed

Lines of Context:
194
194
        return None
195
195
 
196
196
 
197
 
def restart_on_change(restart_map):
 
197
def restart_on_change(restart_map, stopstart=False):
198
198
    """Restart services based on configuration files changing
199
199
 
200
200
    This function is used a decorator, for example
219
219
            for path in restart_map:
220
220
                if checksums[path] != file_hash(path):
221
221
                    restarts += restart_map[path]
222
 
            for service_name in list(OrderedDict.fromkeys(restarts)):
223
 
                service('restart', service_name)
 
222
            services_list = list(OrderedDict.fromkeys(restarts))
 
223
            if not stopstart:
 
224
                for service_name in services_list:
 
225
                    service('restart', service_name)
 
226
            else:
 
227
                for action in ['stop', 'start']:
 
228
                    for service_name in services_list:
 
229
                        service(action, service_name)
224
230
        return wrapped_f
225
231
    return wrap
226
232
 
279
285
        if 'mtu' in words:
280
286
            mtu = words[words.index("mtu") + 1]
281
287
    return mtu
 
288
 
 
289
 
 
290
def get_nic_hwaddr(nic):
 
291
    cmd = ['ip', '-o', '-0', 'addr', 'show', nic]
 
292
    ip_output = subprocess.check_output(cmd)
 
293
    hwaddr = ""
 
294
    words = ip_output.split()
 
295
    if 'link/ether' in words:
 
296
        hwaddr = words[words.index('link/ether') + 1]
 
297
    return hwaddr