charmhelpers.fetch.snap package

Charm helpers snap for classic charms.

If writing reactive charms, use the snap layer: https://lists.ubuntu.com/archives/snapcraft/2016-September/001114.html

exception charmhelpers.fetch.snap.CouldNotAcquireLockException

Bases: Exception

exception charmhelpers.fetch.snap.InvalidSnapChannel

Bases: Exception

charmhelpers.fetch.snap.snap_install(packages, *flags)

Install a snap package.

Parameters:
  • packages – String or List String package name
  • flags – List String flags to pass to install command
Returns:

Integer return code from snap

charmhelpers.fetch.snap.snap_refresh(packages, *flags)

Refresh / Update snap package.

Parameters:
  • packages – String or List String package name
  • flags – List String flags to pass to refresh command
Returns:

Integer return code from snap

charmhelpers.fetch.snap.snap_remove(packages, *flags)

Remove a snap package.

Parameters:
  • packages – String or List String package name
  • flags – List String flags to pass to remove command
Returns:

Integer return code from snap

charmhelpers.fetch.snap.valid_snap_channel(channel)

Validate snap channel exists

Raises:InvalidSnapChannel – When channel does not exist
Returns:Boolean

Examples

snap_install('hello-world', '--classic', '--stable')
snap_install(['hello-world', 'htop'])
snap_refresh('hello-world', '--classic', '--stable')
snap_refresh(['hello-world', 'htop'])
snap_remove('hello-world')
snap_remove(['hello-world', 'htop'])