def install(): # Do nothing if we don't have kernel support yet if not kernel_supported(): return opts = sorted_snap_opts() # 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().machine 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()
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()
def refresh(): 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: continue snap.refresh(snapname, **snap_opts) snap.connect_all()
def refresh(): # Do nothing if we don't have kernel support yet if not kernel_supported(): return opts = sorted_snap_opts() # 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: continue snap.refresh(snapname, **snap_opts) snap.connect_all()
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()
def refresh(): opts = layer.options('snap') for snapname, snap_opts in opts.items(): snap.refresh(snapname, **snap_opts) snap.connect_all()
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()