~ajkavanagh/charms/trusty/mongodb/fix-unit-test-lint-lp1533654

« back to all changes in this revision

Viewing changes to hooks/hooks.py

  • Committer: Matt Bruzek
  • Date: 2015-01-13 17:51:52 UTC
  • mfrom: (53.6.1 merge-precise-patches)
  • Revision ID: matthew.bruzek@canonical.com-20150113175152-9czpslqsolbf9i9l
[wes] Merge exec.d and volume relation_id patches from precise charm
[mbruzek] Fixed lint errors in hooks.py file so tests would pass.

Show diffs side-by-side

added added

removed removed

Lines of Context:
43
43
 
44
44
from charmhelpers.core.hookenv import log as juju_log
45
45
 
 
46
from charmhelpers.payload.execd import execd_preinstall
 
47
 
46
48
from charmhelpers.core.host import (
47
49
    service,
48
50
    lsb_release,
721
723
 
722
724
""" % (cron_runtime, script_filename))
723
725
 
 
726
 
724
727
# We can remove this quirk when charm no longer supports trusty
725
728
def arm64_trusty_quirk():
726
729
    arch = subprocess.check_output(['dpkg', '--print-architecture']).strip()
733
736
             "mongodb port, enabling installs from %s ***" % (ppa))
734
737
    add_source(ppa)
735
738
 
 
739
 
736
740
###############################################################################
737
741
# Hook functions
738
742
###############################################################################
739
743
@hooks.hook('install')
740
744
def install_hook():
 
745
    juju_log('Begin install hook.')
 
746
    execd_preinstall()
741
747
    juju_log("Installing mongodb")
742
748
    add_source(config('source'), config('key'))
743
749
 
744
750
    # Allow users to bypass arm64/trusty workaround by adding their own source
745
751
    if config('source') == 'None':
746
 
        arm64_trusty_quirk()
 
752
        arm64_trusty_quirk()
747
753
 
748
754
    apt_update(fatal=True)
749
755
    apt_install(packages=['mongodb-server', 'mongodb-clients', 'python-yaml'],
1013
1019
def data_relation_joined():
1014
1020
    juju_log("data_relation_joined")
1015
1021
 
1016
 
    return(relation_set(
1017
 
        {
1018
 
            'mountpoint': '/srv/juju/mongodb-data'
1019
 
        }))
 
1022
    return relation_set(relation_id(),
 
1023
                        {'mountpoint': '/srv/juju/mongodb-data'})
1020
1024
 
1021
1025
 
1022
1026
@hooks.hook('data-relation-changed')