Page Menu
Home
DevCentral
Search
Configure Global Search
Log In
Files
F3744171
D2577.id6510.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
6 KB
Referenced Files
None
Subscribers
None
D2577.id6510.diff
View Options
diff --git a/_modules/jails.py b/_modules/jails.py
--- a/_modules/jails.py
+++ b/_modules/jails.py
@@ -25,7 +25,7 @@
return __grains__["id"]
-def list(group=None):
+def list_jails(group=None):
"""
A function to list the jails for the specified group.
@@ -54,7 +54,7 @@
salt-call --local jails.flatlist ysul
"""
- return " ".join(sorted(list(group)))
+ return " ".join(sorted(list_jails(group)))
def _get_hardware_network_interfaces():
diff --git a/_modules/opensearch.py b/_modules/opensearch.py
--- a/_modules/opensearch.py
+++ b/_modules/opensearch.py
@@ -12,7 +12,7 @@
from salt.exceptions import CommandExecutionError, SaltCloudConfigError
-def get_config(nodename=None):
+def get_config(node_name=None):
"""
A function to get relevant values for OpenSearch configuration.
@@ -20,8 +20,8 @@
salt * opensearch.get_config
"""
- if nodename is None:
- nodename = __grains__["id"]
+ if node_name is None:
+ node_name = __grains__["id"]
try:
clusters = __pillar__["opensearch_clusters"]
@@ -29,17 +29,17 @@
clusters = []
for _, cluster in clusters.items():
- if nodename in cluster["nodes"]:
- return _expand_cluster_config(nodename, cluster)
+ if node_name in cluster["nodes"]:
+ return _expand_cluster_config(node_name, cluster)
raise CommandExecutionError(
SaltCloudConfigError(
- "Node {0} not declared in pillar opensearch_clusters.".format(nodename)
+ "Node {0} not declared in pillar opensearch_clusters.".format(node_name)
)
)
-def _expand_cluster_config(nodename, config):
+def _expand_cluster_config(node_name, config):
config = dict(config)
nodes = _convert_to_ip(config["nodes"])
@@ -47,8 +47,8 @@
{
"nodes": nodes,
"nodes_certificates": _get_nodes_info(config["nodes"]),
- "node_name": nodename,
- "network_host": _get_ip(nodename),
+ "node_name": node_name,
+ "network_host": _get_ip(node_name),
"lead_nodes": nodes,
"dashboards_nodes": nodes,
}
@@ -57,17 +57,17 @@
return config
-def _convert_to_ip(ids):
- return [_get_ip(id) for id in ids]
+def _convert_to_ip(node_names):
+ return [_get_ip(node_name) for node_name in node_names]
-def _get_ip(nodename):
+def _get_ip(node_name):
try:
- network = __pillar__["nodes"][nodename]["network"]
+ network = __pillar__["nodes"][node_name]["network"]
except KeyError:
raise CommandExecutionError(
SaltCloudConfigError(
- "Node {0} not declared in pillar nodes.".format(nodename)
+ "Node {0} not declared in pillar nodes.".format(node_name)
)
)
@@ -76,15 +76,15 @@
return network[field]
-def _get_nodes_info(ids):
- return [_get_node_info(id) for id in ids]
+def _get_nodes_info(node_names):
+ return [_get_node_info(id) for node_name in node_names]
-def _get_node_info(nodename):
+def _get_node_info(node_name):
return {
- "id": nodename,
- "fqdn": __pillar__["nodes"][nodename]["hostname"],
- "ip": _get_ip(nodename),
+ "id": node_name,
+ "fqdn": __pillar__["nodes"][node_name]["hostname"],
+ "ip": _get_ip(node_name),
}
@@ -101,8 +101,8 @@
return __salt__["cmd.shell"](command, env=env)
-def list_certificates(nodename=None):
- config = get_config(nodename=None)
+def list_certificates(node_name=None):
+ config = get_config(node_name)
certificates = ["admin", "root-ca"]
diff --git a/_modules/zr.py b/_modules/zr.py
--- a/_modules/zr.py
+++ b/_modules/zr.py
@@ -44,12 +44,12 @@
return number
except ValueError:
# Case II - expression is a pillar key
- id = _get_credential_id_from_pillar_key(expression)
+ credential_id = _get_credential_id_from_pillar_key(expression)
- if id is None or id == "":
+ if credential_id is None or credential_id == "":
raise ValueError(expression, "Pillar key not found")
- return id
+ return credential_id
def get_password(credential_expression):
diff --git a/roles/paas-jails/jails/init.sls b/roles/paas-jails/jails/init.sls
--- a/roles/paas-jails/jails/init.sls
+++ b/roles/paas-jails/jails/init.sls
@@ -54,7 +54,7 @@
# Build applications/services jails
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-{% for jail in salt['jails.list']() %}
+{% for jail in salt['jails.list_jails']() %}
{% set ips = salt['jails.get_ezjail_ips_parameter'](jail) %}
generate_jail_{{ jail }}:
cmd.run:
diff --git a/utils/dump-py-state.py b/utils/dump-py-state.py
--- a/utils/dump-py-state.py
+++ b/utils/dump-py-state.py
@@ -88,7 +88,7 @@
sls_file = sys.argv[1]
try:
- source_code = assemble_source_code(sls_file)
+ source_code_to_dump = assemble_source_code(sls_file)
except OSError as ex:
print(ex, file=sys.stderr)
exit(ex.errno)
@@ -96,4 +96,4 @@
__pillar__ = load_pillar("pillar")
__grains__ = {"os": system(["uname", "-o"])}
- exec(source_code)
+ exec(source_code_to_dump)
diff --git a/utils/generate-webcontent-index.py b/utils/generate-webcontent-index.py
--- a/utils/generate-webcontent-index.py
+++ b/utils/generate-webcontent-index.py
@@ -29,8 +29,10 @@
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-pillar_file = "pillar/webserver/sites.sls"
-file_to_update = "roles/webserver-content/init.sls"
+config = {
+ "pillar": "pillar/webserver/sites.sls",
+ "states": "roles/webserver-content/init.sls",
+}
# -------------------------------------------------------------
@@ -72,4 +74,4 @@
if __name__ == "__main__":
- do_update(pillar_file, file_to_update)
+ do_update(config["pillar"], config["states"])
diff --git a/utils/next-uid.py b/utils/next-uid.py
--- a/utils/next-uid.py
+++ b/utils/next-uid.py
@@ -29,6 +29,6 @@
]
-users = get_shellusers(USERS_DATASOURCE, USERS_DATASOURCE_KEY)
-uids = get_uids(users, USERS_CUT)
+shell_users = get_shellusers(USERS_DATASOURCE, USERS_DATASOURCE_KEY)
+uids = get_uids(shell_users, USERS_CUT)
print(max(uids) + 1)
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sat, Nov 16, 03:48 (18 h, 22 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2247067
Default Alt Text
D2577.id6510.diff (6 KB)
Attached To
Mode
D2577: Don't shadow variables
Attached
Detach File
Event Timeline
Log In to Comment