zookeeper

Interface with a Zookeeper service.

Important

This module requires the general Zookeeper setup.

saltext.zookeeper.modules.zookeeper.create(path, value='', acls=None, ephemeral=False, sequence=False, makepath=False, profile=None, hosts=None, scheme=None, username=None, password=None, default_acl=None)[source]

Create Znode

path

path of znode to create

value

value to assign to znode (Default: ‘’)

acls

list of acl dictionaries to be assigned (Default: None)

ephemeral

indicate node is ephemeral (Default: False)

sequence

indicate node is suffixed with a unique index (Default: False)

makepath

Create parent paths if they do not exist (Default: False)

profile

Configured Zookeeper profile to authenticate with (Default: None)

hosts

Lists of Zookeeper Hosts (Default: ‘127.0.0.1:2181)

scheme

Scheme to authenticate with (Default: ‘digest’)

username

Username to authenticate (Default: None)

password

Password to authenticate (Default: None)

default_acl

Default acls to assign if a node is created in this connection (Default: None)

CLI Example:

salt minion1 zookeeper.create /test/name daniel profile=prod
saltext.zookeeper.modules.zookeeper.ensure_path(path, acls=None, profile=None, hosts=None, scheme=None, username=None, password=None, default_acl=None)[source]

Ensure Znode path exists

path

Parent path to create

acls

list of acls dictionaries to be assigned (Default: None)

profile

Configured Zookeeper profile to authenticate with (Default: None)

hosts

Lists of Zookeeper Hosts (Default: ‘127.0.0.1:2181)

scheme

Scheme to authenticate with (Default: ‘digest’)

username

Username to authenticate (Default: None)

password

Password to authenticate (Default: None)

default_acl

Default acls to assign if a node is created in this connection (Default: None)

CLI Example:

salt minion1 zookeeper.ensure_path /test/name profile=prod
saltext.zookeeper.modules.zookeeper.exists(path, profile=None, hosts=None, scheme=None, username=None, password=None, default_acl=None)[source]

Check if path exists

path

path to check

profile

Configured Zookeeper profile to authenticate with (Default: None)

hosts

Lists of Zookeeper Hosts (Default: ‘127.0.0.1:2181)

scheme

Scheme to authenticate with (Default: ‘digest’)

username

Username to authenticate (Default: None)

password

Password to authenticate (Default: None)

default_acl

Default acls to assign if a node is created in this connection (Default: None)

CLI Example:

salt minion1 zookeeper.exists /test/name profile=prod
saltext.zookeeper.modules.zookeeper.get(path, profile=None, hosts=None, scheme=None, username=None, password=None, default_acl=None)[source]

Get value saved in znode

path

path to check

profile

Configured Zookeeper profile to authenticate with (Default: None)

hosts

Lists of Zookeeper Hosts (Default: ‘127.0.0.1:2181)

scheme

Scheme to authenticate with (Default: ‘digest’)

username

Username to authenticate (Default: None)

password

Password to authenticate (Default: None)

default_acl

Default acls to assign if a node is created in this connection (Default: None)

CLI Example:

salt minion1 zookeeper.get /test/name profile=prod
saltext.zookeeper.modules.zookeeper.get_children(path, profile=None, hosts=None, scheme=None, username=None, password=None, default_acl=None)[source]

Get children in znode path

path

path to check

profile

Configured Zookeeper profile to authenticate with (Default: None)

hosts

Lists of Zookeeper Hosts (Default: ‘127.0.0.1:2181)

scheme

Scheme to authenticate with (Default: ‘digest’)

username

Username to authenticate (Default: None)

password

Password to authenticate (Default: None)

default_acl

Default acls to assign if a node is created in this connection (Default: None)

CLI Example:

salt minion1 zookeeper.get_children /test profile=prod
saltext.zookeeper.modules.zookeeper.set(path, value, version=-1, profile=None, hosts=None, scheme=None, username=None, password=None, default_acl=None)[source]

Update znode with new value

path

znode to update

value

value to set in znode

version

only update znode if version matches (Default: -1 (always matches))

profile

Configured Zookeeper profile to authenticate with (Default: None)

hosts

Lists of Zookeeper Hosts (Default: ‘127.0.0.1:2181)

scheme

Scheme to authenticate with (Default: ‘digest’)

username

Username to authenticate (Default: None)

password

Password to authenticate (Default: None)

default_acl

Default acls to assign if a node is created in this connection (Default: None)

CLI Example:

salt minion1 zookeeper.set /test/name gtmanfred profile=prod
saltext.zookeeper.modules.zookeeper.get_acls(path, profile=None, hosts=None, scheme=None, username=None, password=None, default_acl=None)[source]

Get acls on a znode

path

path to znode

profile

Configured Zookeeper profile to authenticate with (Default: None)

hosts

Lists of Zookeeper Hosts (Default: ‘127.0.0.1:2181)

scheme

Scheme to authenticate with (Default: ‘digest’)

username

Username to authenticate (Default: None)

password

Password to authenticate (Default: None)

default_acl

Default acls to assign if a node is created in this connection (Default: None)

CLI Example:

salt minion1 zookeeper.get_acls /test/name profile=prod
saltext.zookeeper.modules.zookeeper.set_acls(path, acls, version=-1, profile=None, hosts=None, scheme=None, username=None, password=None, default_acl=None)[source]

Set acls on a znode

path

path to znode

acls

list of acl dictionaries to set on the znode

version

only set acls if version matches (Default: -1 (always matches))

profile

Configured Zookeeper profile to authenticate with (Default: None)

hosts

Lists of Zookeeper Hosts (Default: ‘127.0.0.1:2181)

scheme

Scheme to authenticate with (Default: ‘digest’)

username

Username to authenticate (Default: None)

password

Password to authenticate (Default: None)

default_acl

Default acls to assign if a node is created in this connection (Default: None)

CLI Example:

salt minion1 zookeeper.set_acls /test/name acls='[{"username": "gtmanfred", "password": "test", "all": True}]' profile=prod
saltext.zookeeper.modules.zookeeper.delete(path, version=-1, recursive=False, profile=None, hosts=None, scheme=None, username=None, password=None, default_acl=None)[source]

Delete znode

path

path to znode

version

only delete if version matches (Default: -1 (always matches))

profile

Configured Zookeeper profile to authenticate with (Default: None)

hosts

Lists of Zookeeper Hosts (Default: ‘127.0.0.1:2181)

scheme

Scheme to authenticate with (Default: ‘digest’)

username

Username to authenticate (Default: None)

password

Password to authenticate (Default: None)

default_acl

Default acls to assign if a node is created in this connection (Default: None)

CLI Example:

salt minion1 zookeeper.delete /test/name profile=prod
saltext.zookeeper.modules.zookeeper.make_digest_acl(username, password, read=False, write=False, create=False, delete=False, admin=False, allperms=False)[source]

Generate acl object

Note

This is heavily used in the zookeeper state and probably is not useful as a cli module

username

username of acl

password

plain text password of acl

read

read acl

write

write acl

create

create acl

delete

delete acl

admin

admin acl

allperms

set all other acls to True

CLI Example:

salt minion1 zookeeper.make_digest_acl username=daniel password=mypass allperms=True