~rharding/charms/precise/juju-gui/update-nagios

« back to all changes in this revision

Viewing changes to hooks/backend.py

  • Committer: Rick Harding
  • Date: 2014-01-15 14:50:46 UTC
  • mfrom: (147.1.8 remove-pyjuju)
  • Revision ID: rick.harding@canonical.com-20140115145046-lyh9879k9x8hwb8i
Remove support for PyJuju and rapi from charm.

- Removes the support for running rapi/pyjuju.
- Removes the agent used to communicate with zookeeper.
- Removes anything pertaining to zookeeper.
- Attempts to clean up docs and such to make sense with pure juju-core.

Show diffs side-by-side

added added

removed removed

Lines of Context:
67
67
        shutil.rmtree(utils.BASE_DIR)
68
68
 
69
69
 
70
 
class PythonInstallMixinBase(object):
71
 
    """Provide a common "install" method to ImprovMixin and PythonMixin."""
72
 
 
73
 
    def install(self, backend):
74
 
        if (not os.path.exists(utils.JUJU_AGENT_DIR) or
75
 
                backend.different('staging', 'juju-api-branch')):
76
 
            utils.fetch_api(backend.config['juju-api-branch'])
77
 
 
78
 
 
79
 
class ImprovMixin(PythonInstallMixinBase):
80
 
    """Manage the improv backend when on staging."""
81
 
 
82
 
    debs = ('zookeeper',)
83
 
 
84
 
    def start(self, backend):
85
 
        config = backend.config
86
 
        utils.start_improv(
87
 
            config['staging-environment'], config['ssl-cert-path'])
88
 
 
89
 
    def stop(self, backend):
90
 
        utils.stop_improv()
91
 
 
92
 
 
93
70
class SandboxMixin(object):
94
71
    pass
95
72
 
96
73
 
97
 
class PythonMixin(PythonInstallMixinBase):
98
 
    """Manage the real PyJuju backend."""
99
 
 
100
 
    def start(self, backend):
101
 
        utils.start_agent(backend.config['ssl-cert-path'])
102
 
 
103
 
    def stop(self, backend):
104
 
        utils.stop_agent()
105
 
 
106
 
 
107
74
class GoMixin(object):
108
75
    """Manage the real Go juju-core backend."""
109
76
    pass
149
116
            config['juju-gui-debug'], config['serve-tests'])
150
117
        utils.write_gui_config(
151
118
            config['juju-gui-console-enabled'], config['login-help'],
152
 
            config['read-only'], config['staging'], config['charmworld-url'],
 
119
            config['read-only'], config['charmworld-url'],
153
120
            build_dir, secure=config['secure'], sandbox=config['sandbox'],
154
121
            ga_key=config['ga-key'],
155
122
            show_get_juju_button=config['show-get-juju-button'],
255
222
        self.prev_config = prev_config
256
223
        self.mixins = [SetUpMixin()]
257
224
 
258
 
        is_legacy_juju = utils.legacy_juju()
259
 
 
260
 
        if config['staging']:
261
 
            if not is_legacy_juju:
262
 
                raise ValueError('Unable to use staging with go backend')
263
 
            self.mixins.append(ImprovMixin())
264
 
        elif config['sandbox']:
 
225
        if config['sandbox']:
265
226
            self.mixins.append(SandboxMixin())
266
227
        else:
267
 
            mixin = PythonMixin() if is_legacy_juju else GoMixin()
 
228
            mixin = GoMixin()
268
229
            self.mixins.append(mixin)
269
230
 
270
231
        # We always install and start the GUI.