etcd.directory_ops module

class etcd.directory_ops.DirectoryOps(client)[source]

Bases: etcd.common_ops.CommonOps

Functions specific to directory management.

create(path, ttl=None)[source]

A normal node-set will implicitly create directories on the way to setting a value. This call exists for when you’d like to -explicitly- create one.

We implicitly fail if the directory already exists.

Parameters:
  • path (string) – Key
  • ttl (int or None) – Time until removed
Returns:

Response object

Return type:

etcd.response.ResponseV2

Raises:

EtcdAlreadyExistsException

delete(path, current_value=None, current_index=None)[source]

Delete the given directory. It must be empty.

Parameters:
  • path (string) – Key
  • current_index (int or None) – Current index to check
Returns:

Response object

Return type:

etcd.response.ResponseV2

delete_if_index(path, current_index)[source]

Only delete the given directory if the node is at the given index. It must be empty.

Parameters:
  • path (string) – Key
  • current_index (int or None) – Current index to check
Returns:

Response object

Return type:

etcd.response.ResponseV2

delete_recursive(path, current_index=None)[source]

Delete the given directory, along with any children.

Parameters:
  • path (string) – Key
  • current_index (int or None) – Current index to check
Returns:

Response object

Return type:

etcd.response.ResponseV2

delete_recursive_if_index(path, current_index)[source]

Only delete the given directory (and its children) if the node is at the given index.

Parameters:
  • path (string) – Key
  • current_index (int or None) – Current index to check
Returns:

Response object

Return type:

etcd.response.ResponseV2