charmhelpers.contrib.unison package

charmhelpers.contrib.unison.collect_authed_hosts(peer_interface)

Iterate through the units on peer interface to find all that have the calling host in its authorized hosts list

charmhelpers.contrib.unison.create_private_key(user, priv_key_path, key_type='rsa')
charmhelpers.contrib.unison.create_public_key(user, priv_key_path, pub_key_path)
charmhelpers.contrib.unison.ensure_user(user, group=None)
charmhelpers.contrib.unison.get_homedir(user)
charmhelpers.contrib.unison.get_keypair(user)
charmhelpers.contrib.unison.remove_password_expiry(username, lastday=None, *, expiredate='-1', inactive='-1', mindays='0', maxdays='-1', root=None, warndays=None)

Change user password expiry information

Parameters:
  • username (str) – User to update
  • lastday (str) – Set when password was changed in YYYY-MM-DD format
  • expiredate (str) – Set when user’s account will no longer be accessible in YYYY-MM-DD format. -1 will remove an account expiration date.
  • inactive (str) – Set the number of days of inactivity after a password has expired before the account is locked. -1 will remove an account’s inactivity.
  • mindays (str) – Set the minimum number of days between password changes to MIN_DAYS. 0 indicates the password can be changed anytime.
  • maxdays (str) – Set the maximum number of days during which a password is valid. -1 as MAX_DAYS will remove checking maxdays
  • root (str) – Apply changes in the CHROOT_DIR directory
  • warndays (str) – Set the number of days of warning before a password change is required
Raises:

subprocess.CalledProcessError – if call to chage fails

charmhelpers.contrib.unison.run_as_user(user, cmd, gid=None)
charmhelpers.contrib.unison.ssh_authorized_peers(peer_interface, user, group=None, ensure_local_user=False)

Main setup function, should be called from both peer -changed and -joined hooks with the same parameters.

charmhelpers.contrib.unison.sync_path_to_host(path, host, user, verbose=False, cmd=None, gid=None, fatal=False)

Sync path to an specific peer host

Propagates exception if operation fails and fatal=True.

charmhelpers.contrib.unison.sync_to_peer(host, user, paths=None, verbose=False, cmd=None, gid=None, fatal=False)

Sync paths to an specific peer host

Propagates exception if any operation fails and fatal=True.

charmhelpers.contrib.unison.sync_to_peers(peer_interface, user, paths=None, verbose=False, cmd=None, gid=None, fatal=False)

Sync all hosts to an specific path

The type of group is integer, it allows user has permissions to operate a directory have a different group id with the user id.

Propagates exception if any operation fails and fatal=True.

charmhelpers.contrib.unison.write_authorized_keys(user, keys)
charmhelpers.contrib.unison.write_known_hosts(user, hosts)