Page MenuHomeDevCentral

D1701.id4325.diff
No OneTemporary

D1701.id4325.diff

diff --git a/_modules/convert.py b/_modules/convert.py
--- a/_modules/convert.py
+++ b/_modules/convert.py
@@ -14,23 +14,23 @@
def to_json_from_pillar_key(key):
- '''
+ """
A function to output a pillar key in JSON.
CLI Example::
salt-call --local convert.to_json "Hello world"
- '''
+ """
data = __pillar__.get(key, {})
return to_json(data)
def to_json(data):
- '''
+ """
A function to convert data to JSON.
CLI Example::
salt-call --local convert.to_json "Hello world"
- '''
+ """
return json.dumps(data, indent=4, sort_keys=True)
diff --git a/_modules/forest.py b/_modules/forest.py
--- a/_modules/forest.py
+++ b/_modules/forest.py
@@ -11,37 +11,37 @@
def exists(forest):
- '''
+ """
A function to check if a forest exists.
CLI Example::
salt '*' forest.exists eglide
- '''
+ """
return forest in __pillar__.get('forests', [])
def get():
- '''
+ """
A function to get the forest of the current minion
CLI Example::
salt '*' forest.get
- '''
+ """
nodes = __pillar__.get('nodes')
minion = __grains__['id']
return nodes[minion]['forest']
def list_groups(forest=None):
- '''
+ """
A function to list groups for a forest.
CLI Example::
salt '*' forest.list_groups
- '''
+ """
if forest is None:
forest = get()
@@ -72,13 +72,13 @@
def list_users(forest=None):
- '''
+ """
A function to list groups for a forest.
CLI Example::
salt '*' forest.list_users
- '''
+ """
users = []
for group in get_groups(forest).values():
@@ -89,14 +89,14 @@
def get_users(forest=None):
- '''
+ """
A function to get users for a forest as a dictionary,
including the users properties.
CLI Example::
salt '*' forest.get_users
- '''
+ """
users = {}
for username in list_users(forest):
diff --git a/_modules/jails.py b/_modules/jails.py
--- a/_modules/jails.py
+++ b/_modules/jails.py
@@ -18,21 +18,21 @@
def _get_default_group():
- '''
+ """
Gets the default group to use as key to
the pillar's jails dictionary.
- '''
+ """
return __grains__['id']
def list(group=None):
- '''
+ """
A function to list the jails for the specified group.
CLI Example::
salt '*' jails.list
- '''
+ """
all_jails = _get_all_jails()
if group is None:
@@ -45,7 +45,7 @@
def flatlist(group=None):
- '''
+ """
A function to list the jails for the specified group.
Output is a string, ready to pass to jail_list in rc.
@@ -53,7 +53,7 @@
CLI Example::
salt-call --local jails.flatlist ysul
- '''
+ """
return " ".join(sorted(list(group)))
@@ -66,10 +66,10 @@
def guess_ipv4_network_interface():
- '''
+ """
A function tu guess to what network interface bind the
public IPv4 jail IP.
- '''
+ """
interfaces = _get_hardware_network_interfaces()
if len(interfaces) < 1:
@@ -81,10 +81,10 @@
def guess_ipv6_network_interface():
- '''
+ """
A function tu guess to what network interface bind the
public IPv6 jail IP.
- '''
+ """
interfaces = _get_ipv6_network_interfaces()
for interface in interfaces:
@@ -104,13 +104,13 @@
def get(jailname, group=None):
- '''
+ """
A function to get a jail pillar configuration
CLI Example::
salt-call --local jails.get mumble ysul
- '''
+ """
if group is None:
group = _get_default_group()
@@ -119,14 +119,14 @@
def get_ezjail_ips_parameter(jailname, group=None):
- '''
+ """
A function to get the parameters to describe the jail
IP configuration to `ezjail-admin create` command.
CLI Example::
salt * jails.get_ezjail_ips_parameter ftp
- '''
+ """
jail = get(jailname, group)
config = [
diff --git a/_modules/node.py b/_modules/node.py
--- a/_modules/node.py
+++ b/_modules/node.py
@@ -18,13 +18,13 @@
def get_all_properties(nodename=None):
- '''
+ """
A function to get a node pillar configuration.
CLI Example:
salt * node.get_all_properties
- '''
+ """
if nodename is None:
nodename = __grains__['id']
@@ -41,13 +41,13 @@
def get(key, nodename=None):
- '''
+ """
A function to get a node pillar configuration key.
CLI Example:
salt * node.get hostname
- '''
+ """
return _get_property(key, nodename, None)
@@ -78,7 +78,7 @@
def get_list(key, nodename=None):
- '''
+ """
A function to get a node pillar configuration.
Returns a list if found, or an empty list if not found.
@@ -86,12 +86,12 @@
CLI Example:
salt * node.list network:ipv4_aliases
- '''
+ """
return _get_property(key, nodename, [])
def has(key, nodename=None):
- '''
+ """
A function to get a node pillar configuration.
Returns a boolean, False if not found.
@@ -99,13 +99,13 @@
CLI Example:
salt * node.has network:ipv6_tunnel
- '''
+ """
value = _get_property(key, nodename, False)
return bool(value)
def has_role(role, nodename=None):
- '''
+ """
A function to determine if a node has the specified role.
Returns a boolean, False if not found.
@@ -113,12 +113,12 @@
CLI Example:
salt * node.has_role devserver
- '''
+ """
return role in get_list('roles', nodename)
def filter_by_role(pillar_key, nodename=None):
- '''
+ """
A function to filter a dictionary by roles.
The dictionary must respect the following structure:
@@ -133,7 +133,7 @@
CLI Example:
salt * node.filter_by_role web_content_sls
- '''
+ """
roles = get_list('roles', nodename)
dictionary = __pillar__.get(pillar_key, {})
filtered_list = []
@@ -146,7 +146,7 @@
def filter_by_name(pillar_key, nodename=None):
- '''
+ """
A function to filter a dictionary by node name.
The dictionary must respect the following structure:
@@ -161,7 +161,7 @@
CLI Example:
salt * node.filter_by_name mars
- '''
+ """
if nodename is None:
nodename = __grains__['id']
@@ -180,7 +180,7 @@
def get_wwwroot(nodename=None):
- '''
+ """
A function to determine the wwwroot folder to use.
Returns a string depending of the FQDN.
@@ -188,7 +188,7 @@
CLI Example:
salt * node.get_wwwroot
- '''
+ """
hostname = _get_property("hostname", nodename, None)
if hostname is None:

File Metadata

Mime Type
text/plain
Expires
Mon, Nov 25, 17:03 (21 h, 38 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2262560
Default Alt Text
D1701.id4325.diff (6 KB)

Event Timeline