Ejemplo n.º 1
0
def install():
    opts = layer.options('snap')
    for snapname, snap_opts in opts.items():
        installed_state = 'snap.installed.{}'.format(snapname)
        if not reactive.is_state(installed_state):
            snap.install(snapname, **snap_opts)
    if data_changed('snap.install.opts', opts):
        snap.connect_all()
Ejemplo n.º 2
0
def install_snaps():
    ''' Deliver the e2e and kubectl components from the binary resource stream
    packages declared in the charm '''
    channel = hookenv.config('channel')
    hookenv.status_set('maintenance', 'Installing kubectl snap')
    snap.install('kubectl', channel=channel, classic=True)
    hookenv.status_set('maintenance', 'Installing kubernetes-test snap')
    snap.install('kubernetes-test', channel=channel, classic=True)
    set_state('kubernetes-e2e.installed')
Ejemplo n.º 3
0
def install_snaps():
    ''' Deliver the e2e and kubectl components from the binary resource stream
    packages declared in the charm '''
    channel = hookenv.config('channel')
    hookenv.status_set('maintenance', 'Installing kubectl snap')
    snap.install('kubectl', channel=channel, classic=True)
    hookenv.status_set('maintenance', 'Installing kubernetes-test snap')
    snap.install('kubernetes-test', channel=channel, classic=True)
    set_state('kubernetes-e2e.installed')
Ejemplo n.º 4
0
def install_snaps():
    channel = hookenv.config('channel')
    hookenv.status_set('maintenance', 'Installing kubectl snap')
    snap.install('kubectl', channel=channel, classic=True)
    hookenv.status_set('maintenance', 'Installing kube-apiserver snap')
    snap.install('kube-apiserver', channel=channel)
    hookenv.status_set('maintenance',
                       'Installing kube-controller-manager snap')
    snap.install('kube-controller-manager', channel=channel)
    hookenv.status_set('maintenance', 'Installing kube-scheduler snap')
    snap.install('kube-scheduler', channel=channel)
    hookenv.status_set('maintenance', 'Installing cdk-addons snap')
    snap.install('cdk-addons', channel=channel)
    set_state('kubernetes-master.snaps.installed')
Ejemplo n.º 5
0
def install_snaps():
    channel = hookenv.config('channel')
    hookenv.status_set('maintenance', 'Installing kubectl snap')
    snap.install('kubectl', channel=channel, classic=True)
    hookenv.status_set('maintenance', 'Installing kube-apiserver snap')
    snap.install('kube-apiserver', channel=channel)
    hookenv.status_set('maintenance',
                       'Installing kube-controller-manager snap')
    snap.install('kube-controller-manager', channel=channel)
    hookenv.status_set('maintenance', 'Installing kube-scheduler snap')
    snap.install('kube-scheduler', channel=channel)
    hookenv.status_set('maintenance', 'Installing cdk-addons snap')
    snap.install('cdk-addons', channel=channel)
    set_state('kubernetes-master.snaps.installed')
Ejemplo n.º 6
0
def install_etcd():
    ''' Attempt resource get on the "etcd" and "etcdctl" resources. If no
    resources are provided attempt to install from the archive only on the
    16.04 (xenial) series. '''

    if is_state('etcd.installed'):
        msg = 'Manual upgrade required. run-action snap-upgrade.'
        status_set('blocked', msg)
        return

    status_set('maintenance', 'Installing etcd.')

    channel = get_target_etcd_channel()
    if channel:
        snap.install('etcd', channel=channel, classic=False)
Ejemplo n.º 7
0
def install_etcd():
    ''' Attempt resource get on the "etcd" and "etcdctl" resources. If no
    resources are provided attempt to install from the archive only on the
    16.04 (xenial) series. '''

    if charms.reactive.is_state('etcd.installed'):
        msg = 'Manual upgrade required. run-action snap-upgrade.'
        status_set('blocked', msg)
        return

    status_set('maintenance', 'Installing etcd.')

    channel = hookenv.config('channel')
    # Grab the snap channel from config
    snap.install('etcd', channel=channel, classic=False)
Ejemplo n.º 8
0
def install_etcd():
    """Attempt resource get on the "etcd" and "etcdctl" resources. If no
    resources are provided attempt to install from the archive only on the
    16.04 (xenial) series."""

    if is_state("etcd.installed"):
        msg = "Manual upgrade required. run-action snap-upgrade."
        status.blocked(msg)
        return

    status.maintenance("Installing etcd.")

    channel = get_target_etcd_channel()
    if channel:
        snap.install("etcd", channel=channel, classic=False)
Ejemplo n.º 9
0
def install():
    opts = layer.options('snap')
    # supported-architectures is EXPERIMENTAL and undocumented.
    # It probably should live in the base layer, blocking the charm
    # during bootstrap if the arch is unsupported.
    arch = uname()[4]
    for snapname, snap_opts in opts.items():
        supported_archs = snap_opts.pop('supported-architectures', None)
        if supported_archs and arch not in supported_archs:
            # Note that this does *not* error. The charm will need to
            # cope with the snaps it requested never getting installed,
            # likely by doing its own check on supported-architectures.
            hookenv.log('Snap {} not supported on {!r} architecture'
                        ''.format(snapname, arch), ERROR)
            continue
        installed_flag = 'snap.installed.{}'.format(snapname)
        if not reactive.is_flag_set(installed_flag):
            snap.install(snapname, **snap_opts)
    if data_changed('snap.install.opts', opts):
        snap.connect_all()
Ejemplo n.º 10
0
def install_packages():
    pin_dse()

    apt.queue_install(cassandra.get_deb_packages())

    if reactive.is_flag_set('apt.queued_installs'):
        with helpers.autostart_disabled():
            if not apt.install_queued():
                return  # apt layer already left us in a blocked state

    if cassandra.get_edition() == 'apache-snap':
        snap.install('cassandra')
    elif cassandra.get_jre() == 'oracle':
        tb = fetch_oracle_jre()
        if tb is None:
            return
        install_oracle_jre_tarball(tb)
    elif cassandra.get_jre() == 'openjdk':
        subprocess.check_call(['update-java-alternatives', '--jre-headless', '--set', 'java-1.8.0-openjdk-amd64'])
    reactive.set_flag('cassandra.installed')
def install_snaps():
    channel = hookenv.config('channel')
    hookenv.status_set('maintenance', 'Installing core snap')
    snap.install('core')
    hookenv.status_set('maintenance', 'Installing kubectl snap')
    snap.install('kubectl', channel=channel, classic=True)
    hookenv.status_set('maintenance', 'Installing kubelet snap')
    snap.install('kubelet', channel=channel, classic=True)
    hookenv.status_set('maintenance', 'Installing kube-proxy snap')
    snap.install('kube-proxy', channel=channel, classic=True)
    calculate_and_store_resource_checksums(checksum_prefix, snap_resources)
    set_state('kubernetes-worker.snaps.installed')
    set_state('kubernetes-worker.restart-needed')
    remove_state('kubernetes-worker.snaps.upgrade-needed')
    remove_state('kubernetes-worker.snaps.upgrade-specified')
Ejemplo n.º 12
0
def install_snaps():
    channel = hookenv.config("channel")
    hookenv.status_set("maintenance", "Installing core snap")
    snap.install("core")
    hookenv.status_set("maintenance", "Installing kubectl snap")
    snap.install("kubectl", channel=channel, classic=True)
    hookenv.status_set("maintenance", "Installing kubelet snap")
    snap.install("kubelet", channel=channel, classic=True)
    hookenv.status_set("maintenance", "Installing kube-proxy snap")
    snap.install("kube-proxy", channel=channel, classic=True)
    calculate_and_store_resource_checksums(checksum_prefix, snap_resources)
    set_state("kubernetes-node.snaps.installed")
    set_state("kubernetes-worker.restart-needed")
    remove_state("kubernetes-worker.snaps.upgrade-needed")
    remove_state("kubernetes-worker.snaps.upgrade-specified")
Ejemplo n.º 13
0
def install_snaps():
    """Deliver the e2e and kubectl components from the binary resource stream
    packages declared in the charm"""
    channel = hookenv.config("channel")
    hookenv.status_set("maintenance", "Installing core snap")
    snap.install("core")
    hookenv.status_set("maintenance", "Installing kubectl snap")
    snap.install("kubectl", channel=channel, classic=True)
    hookenv.status_set("maintenance", "Installing kubernetes-test snap")
    snap.install("kubernetes-test", channel=channel, classic=True)
    set_state("kubernetes-e2e.installed")
Ejemplo n.º 14
0
def install_snaps():
    check_resources_for_upgrade_needed()
    channel = hookenv.config('channel')
    hookenv.status_set('maintenance', 'Installing kubectl snap')
    snap.install('kubectl', channel=channel, classic=True)
    hookenv.status_set('maintenance', 'Installing kubelet snap')
    snap.install('kubelet', channel=channel, classic=True)
    hookenv.status_set('maintenance', 'Installing kube-proxy snap')
    snap.install('kube-proxy', channel=channel, classic=True)
    set_state('kubernetes-worker.snaps.installed')
    remove_state('kubernetes-worker.snaps.upgrade-needed')
    remove_state('kubernetes-worker.snaps.upgrade-specified')
Ejemplo n.º 15
0
def install_snaps():
    any_file_changed(get_snap_resource_paths())
    channel = hookenv.config('channel')
    hookenv.status_set('maintenance', 'Installing kubectl snap')
    snap.install('kubectl', channel=channel, classic=True)
    hookenv.status_set('maintenance', 'Installing kubelet snap')
    snap.install('kubelet', channel=channel, classic=True)
    hookenv.status_set('maintenance', 'Installing kube-proxy snap')
    snap.install('kube-proxy', channel=channel, classic=True)
    set_state('kubernetes-worker.snaps.installed')
    set_state('kubernetes-worker.restart-needed')
    remove_state('kubernetes-worker.snaps.upgrade-needed')
    remove_state('kubernetes-worker.snaps.upgrade-specified')
Ejemplo n.º 16
0
def install_snaps():
    any_file_changed(get_snap_resource_paths())
    channel = hookenv.config('channel')
    hookenv.status_set('maintenance', 'Installing kubectl snap')
    snap.install('kubectl', channel=channel, classic=True)
    hookenv.status_set('maintenance', 'Installing kubelet snap')
    snap.install('kubelet', channel=channel, classic=True)
    hookenv.status_set('maintenance', 'Installing kube-proxy snap')
    snap.install('kube-proxy', channel=channel, classic=True)
    set_state('kubernetes-worker.snaps.installed')
    set_state('kubernetes-worker.restart-needed')
    remove_state('kubernetes-worker.snaps.upgrade-needed')
    remove_state('kubernetes-worker.snaps.upgrade-specified')
Ejemplo n.º 17
0
def install_snaps():
    channel = hookenv.config('channel')
    hookenv.status_set('maintenance', 'Installing kubectl snap')
    snap.install('kubectl', channel=channel, classic=True)
    hookenv.status_set('maintenance', 'Installing kubelet snap')
    snap.install('kubelet', channel=channel, classic=True)
    hookenv.status_set('maintenance', 'Installing kube-proxy snap')
    snap.install('kube-proxy', channel=channel, classic=True)
    calculate_and_store_resource_checksums()
    set_state('kubernetes-worker.snaps.installed')
    set_state('kubernetes-worker.restart-needed')
    remove_state('kubernetes-worker.snaps.upgrade-needed')
    remove_state('kubernetes-worker.snaps.upgrade-specified')
Ejemplo n.º 18
0
def install_matrix_ircd():
    """Installs matrix IRCd snap."""
    if matrix.charm_config.get("enable-ircd"):
        hookenv.status_set("maintenance", "Installing Matrix IRCd")
        snap.install("matrix-ircd")
        hookenv.status_set("active", "Matrix Installed")
Ejemplo n.º 19
0
def install_matrix_synapse():
    """Installs matrix synapse snap."""
    hookenv.status_set("maintenance", "Installing Matrix")
    snap.install("matrix-synapse")
    hookenv.status_set("active", "Matrix Installed")
Ejemplo n.º 20
0
def install_kafka():
    snap.install('kafka')
    snap.connect('kafka:removable-media', 'core:removable-media')
Ejemplo n.º 21
0
def snap_install():
    channel = get_target_etcd_channel()
    snap.install("core")
    if channel:
        snap.install("etcd", channel=channel, classic=False)
        remove_state("etcd.ssl.exported")
Ejemplo n.º 22
0
 def install_snap(self, snapname):
     """Install specific snap."""
     result = snap.install(snapname)
     hookenv.log("Snap {} install completed: {}".format(snapname, result),
                 hookenv.DEBUG)
     return result
Ejemplo n.º 23
0
def install_dex():
    ''' Install dex on first run '''
    opts = layer.options('dex')
    snap.install(opts['dex_snap'], channel=config('channel'))
    open_port(config('auth-port'))
    invoke_health_message()
Ejemplo n.º 24
0
def install():
    opts = layer.options('snap')
    for snapname, snap_opts in opts.items():
        snap.install(snapname, **snap_opts)
    if data_changed('snap.install.opts', opts):
        snap.connect_all()
Ejemplo n.º 25
0
def snap_install():
    channel = hookenv.config('channel')
    snap.install('core')
    snap.install('etcd', channel=channel, classic=False)
Ejemplo n.º 26
0
def install_lxd():
    hookenv.status_set('maintenance', 'installing lxd')
    snap.install('lxd')
Ejemplo n.º 27
0
 def install_snap(self, snapname):
     """Install specific snap."""
     snap.install(snapname)
Ejemplo n.º 28
0
def snap_install():
    channel = get_target_etcd_channel()
    snap.install('core')
    if channel:
        snap.install('etcd', channel=channel, classic=False)
        remove_state('etcd.ssl.exported')
Ejemplo n.º 29
0
def install_snap(channel, classic=False):
    ''' Handle installation of snaps, both from resources and from the snap
    store. The only indicator we need is classic mode and the channel '''
    snap.install('etcd', channel=channel, classic=classic)
Ejemplo n.º 30
0
def update_dex_channel():
    ''' React to channel changes and refresh the dex snap '''
    opts = layer.options('dex')
    snap.install(opts['dex_snap'], channel=config('channel'))
    invoke_health_message()
Ejemplo n.º 31
0
def install_snap():
    channel = config('channel')
    # Grab the snap channel from config
    snap.install('lxd', channel=channel)