def install_haproxy(): """Install haproxy when the haproxy.installed flag is not set.""" hookenv.status_set("maintenance", "Installing HAProxy") fetch.add_source(ph.ppa) fetch.apt_update() fetch.install("haproxy") set_state("haproxy.installed")
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. import os from subprocess import check_call from charmhelpers.fetch import ( BaseFetchHandler, UnhandledSource, filter_installed_packages, install, ) from charmhelpers.core.host import mkdir if filter_installed_packages(['bzr']) != []: install(['bzr']) if filter_installed_packages(['bzr']) != []: raise NotImplementedError('Unable to install bzr') class BzrUrlFetchHandler(BaseFetchHandler): """Handler for bazaar branches via generic and lp URLs.""" def can_handle(self, source): url_parts = self.parse_url(source) if url_parts.scheme not in ('bzr+ssh', 'lp', ''): return False elif not url_parts.scheme: return os.path.exists(os.path.join(source, '.bzr')) else: return True
# distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. import os from subprocess import check_output, CalledProcessError, STDOUT from charmhelpers.fetch import ( BaseFetchHandler, UnhandledSource, filter_installed_packages, install, ) if filter_installed_packages(['git']) != []: install(['git']) if filter_installed_packages(['git']) != []: raise NotImplementedError('Unable to install git') class GitUrlFetchHandler(BaseFetchHandler): """Handler for git branches via generic and github URLs.""" def can_handle(self, source): url_parts = self.parse_url(source) # TODO (mattyw) no support for ssh git@ yet if url_parts.scheme not in ('http', 'https', 'git', ''): return False elif not url_parts.scheme: return os.path.exists(os.path.join(source, '.git')) else:
# See the License for the specific language governing permissions and # limitations under the License. import os from subprocess import STDOUT, check_output from charmhelpers.fetch import ( BaseFetchHandler, UnhandledSource, filter_installed_packages, install, ) from charmhelpers.core.host import mkdir if filter_installed_packages(['bzr']) != []: install(['bzr']) if filter_installed_packages(['bzr']) != []: raise NotImplementedError('Unable to install bzr') class BzrUrlFetchHandler(BaseFetchHandler): """Handler for bazaar branches via generic and lp URLs.""" def can_handle(self, source): url_parts = self.parse_url(source) if url_parts.scheme not in ('bzr+ssh', 'lp', ''): return False elif not url_parts.scheme: return os.path.exists(os.path.join(source, '.bzr')) else: return True
# distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. import os from subprocess import check_output, CalledProcessError, STDOUT from charmhelpers.fetch import ( BaseFetchHandler, UnhandledSource, filter_installed_packages, install, ) if filter_installed_packages(['git']) != []: install(['git']) if filter_installed_packages(['git']) != []: raise NotImplementedError('Unable to install git') class GitUrlFetchHandler(BaseFetchHandler): """Handler for git branches via generic and github URLs.""" def can_handle(self, source): url_parts = self.parse_url(source) # TODO (mattyw) no support for ssh git@ yet if url_parts.scheme not in ('http', 'https', 'git', ''): return False elif not url_parts.scheme: return os.path.exists(os.path.join(source, '.git')) else: return True