summaryrefslogtreecommitdiff
path: root/contrib
diff options
context:
space:
mode:
authorMatt Clay <matt@mystile.com>2017-11-20 19:08:30 -0800
committerMatt Clay <matt@mystile.com>2017-11-21 10:03:34 -0800
commite45c763b646e0609fb9c8d8b8cdf9c200985c313 (patch)
tree0d6ef485414a21b38a943f5836193bc109f3d85d /contrib
parentf9cd50411fb8bb6504639bc817403d0cf8f02d24 (diff)
downloadansible-e45c763b646e0609fb9c8d8b8cdf9c200985c313.tar.gz
Fix invalid string escape sequences.
Diffstat (limited to 'contrib')
-rwxr-xr-xcontrib/inventory/apache-libcloud.py2
-rwxr-xr-xcontrib/inventory/apstra_aos.py2
-rwxr-xr-xcontrib/inventory/azure_rm.py4
-rwxr-xr-xcontrib/inventory/cloudforms.py2
-rwxr-xr-xcontrib/inventory/cobbler.py2
-rwxr-xr-xcontrib/inventory/collins.py2
-rwxr-xr-xcontrib/inventory/consul_io.py2
-rwxr-xr-xcontrib/inventory/digital_ocean.py2
-rwxr-xr-xcontrib/inventory/docker.py2
-rwxr-xr-xcontrib/inventory/ec2.py4
-rwxr-xr-xcontrib/inventory/fleet.py2
-rwxr-xr-xcontrib/inventory/foreman.py2
-rwxr-xr-xcontrib/inventory/linode.py2
-rwxr-xr-xcontrib/inventory/packet_net.py4
-rwxr-xr-xcontrib/inventory/rax.py2
-rwxr-xr-xcontrib/inventory/rudder.py2
-rwxr-xr-xcontrib/inventory/softlayer.py2
-rwxr-xr-xcontrib/inventory/vagrant.py2
-rwxr-xr-xcontrib/inventory/windows_azure.py2
19 files changed, 22 insertions, 22 deletions
diff --git a/contrib/inventory/apache-libcloud.py b/contrib/inventory/apache-libcloud.py
index 92f799895f..7d6bba2515 100755
--- a/contrib/inventory/apache-libcloud.py
+++ b/contrib/inventory/apache-libcloud.py
@@ -327,7 +327,7 @@ class LibcloudInventory(object):
used as Ansible groups
'''
- return re.sub("[^A-Za-z0-9\-]", "_", word)
+ return re.sub(r"[^A-Za-z0-9\-]", "_", word)
def json_format_dict(self, data, pretty=False):
'''
diff --git a/contrib/inventory/apstra_aos.py b/contrib/inventory/apstra_aos.py
index e8752183cd..2ffd3290f0 100755
--- a/contrib/inventory/apstra_aos.py
+++ b/contrib/inventory/apstra_aos.py
@@ -572,7 +572,7 @@ class AosInventory(object):
- Converting to lowercase
"""
- rx = re.compile('\W+')
+ rx = re.compile(r'\W+')
clean_group = rx.sub('_', group_name).lower()
return clean_group
diff --git a/contrib/inventory/azure_rm.py b/contrib/inventory/azure_rm.py
index 6c79d8b9a2..d790a0a02f 100755
--- a/contrib/inventory/azure_rm.py
+++ b/contrib/inventory/azure_rm.py
@@ -842,9 +842,9 @@ class AzureInventory(object):
def _to_safe(self, word):
''' Converts 'bad' characters in a string to underscores so they can be used as Ansible groups '''
- regex = "[^A-Za-z0-9\_"
+ regex = r"[^A-Za-z0-9\_"
if not self.replace_dash_in_groups:
- regex += "\-"
+ regex += r"\-"
return re.sub(regex + "]", "_", word)
diff --git a/contrib/inventory/cloudforms.py b/contrib/inventory/cloudforms.py
index 69c149bfc5..ecf10a4119 100755
--- a/contrib/inventory/cloudforms.py
+++ b/contrib/inventory/cloudforms.py
@@ -444,7 +444,7 @@ class CloudFormsInventory(object):
Converts 'bad' characters in a string to underscores so they can be used as Ansible groups
"""
if self.cloudforms_clean_group_keys:
- regex = "[^A-Za-z0-9\_]"
+ regex = r"[^A-Za-z0-9\_]"
return re.sub(regex, "_", word.replace(" ", ""))
else:
return word
diff --git a/contrib/inventory/cobbler.py b/contrib/inventory/cobbler.py
index 896fc73588..0443bb3c8c 100755
--- a/contrib/inventory/cobbler.py
+++ b/contrib/inventory/cobbler.py
@@ -271,7 +271,7 @@ class CobblerInventory(object):
def to_safe(self, word):
""" Converts 'bad' characters in a string to underscores so they can be used as Ansible groups """
- return re.sub("[^A-Za-z0-9\-]", "_", word)
+ return re.sub(r"[^A-Za-z0-9\-]", "_", word)
def json_format_dict(self, data, pretty=False):
""" Converts a dict to a JSON object and dumps it as a formatted string """
diff --git a/contrib/inventory/collins.py b/contrib/inventory/collins.py
index bcba11cc1c..a6af0d7302 100755
--- a/contrib/inventory/collins.py
+++ b/contrib/inventory/collins.py
@@ -423,7 +423,7 @@ class CollinsInventory(object):
""" Converts 'bad' characters in a string to underscores so they
can be used as Ansible groups """
- return re.sub("[^A-Za-z0-9\-]", "_", word)
+ return re.sub(r"[^A-Za-z0-9\-]", "_", word)
def json_format_dict(self, data, pretty=False):
""" Converts a dict to a JSON object and dumps it as a formatted string """
diff --git a/contrib/inventory/consul_io.py b/contrib/inventory/consul_io.py
index 8f3a104fdf..c0c2b4e127 100755
--- a/contrib/inventory/consul_io.py
+++ b/contrib/inventory/consul_io.py
@@ -394,7 +394,7 @@ class ConsulInventory(object):
def to_safe(self, word):
''' Converts 'bad' characters in a string to underscores so they can be used
as Ansible groups '''
- return re.sub('[^A-Za-z0-9\-\.]', '_', word)
+ return re.sub(r'[^A-Za-z0-9\-\.]', '_', word)
def sanitize_dict(self, d):
diff --git a/contrib/inventory/digital_ocean.py b/contrib/inventory/digital_ocean.py
index a53a7df937..23fb2c6259 100755
--- a/contrib/inventory/digital_ocean.py
+++ b/contrib/inventory/digital_ocean.py
@@ -460,7 +460,7 @@ or environment variables (DO_API_TOKEN)\n''')
def to_safe(self, word):
''' Converts 'bad' characters in a string to underscores so they can be used as Ansible groups '''
- return re.sub("[^A-Za-z0-9\-\.]", "_", word)
+ return re.sub(r"[^A-Za-z0-9\-\.]", "_", word)
def do_namespace(self, data):
''' Returns a copy of the dictionary with all the keys put in a 'do_' namespace '''
diff --git a/contrib/inventory/docker.py b/contrib/inventory/docker.py
index 461e0d6817..24986e2d58 100755
--- a/contrib/inventory/docker.py
+++ b/contrib/inventory/docker.py
@@ -656,7 +656,7 @@ class DockerInventory(object):
self.hostvars[name].update(facts)
def _slugify(self, value):
- return 'docker_%s' % (re.sub('[^\w-]', '_', value).lower().lstrip('_'))
+ return 'docker_%s' % (re.sub(r'[^\w-]', '_', value).lower().lstrip('_'))
def get_hosts(self, config):
'''
diff --git a/contrib/inventory/ec2.py b/contrib/inventory/ec2.py
index 825a1732db..42cc7a58c4 100755
--- a/contrib/inventory/ec2.py
+++ b/contrib/inventory/ec2.py
@@ -1680,9 +1680,9 @@ class Ec2Inventory(object):
def to_safe(self, word):
''' Converts 'bad' characters in a string to underscores so they can be used as Ansible groups '''
- regex = "[^A-Za-z0-9\_"
+ regex = r"[^A-Za-z0-9\_"
if not self.replace_dash_in_groups:
- regex += "\-"
+ regex += r"\-"
return re.sub(regex + "]", "_", word)
def json_format_dict(self, data, pretty=False):
diff --git a/contrib/inventory/fleet.py b/contrib/inventory/fleet.py
index cf8f647669..e749aa6905 100755
--- a/contrib/inventory/fleet.py
+++ b/contrib/inventory/fleet.py
@@ -61,7 +61,7 @@ def get_ssh_config():
def list_running_boxes():
boxes = []
for line in subprocess.check_output(["fleetctl", "list-machines"]).split('\n'):
- matcher = re.search("[^\s]+[\s]+([^\s]+).+", line)
+ matcher = re.search(r"[^\s]+[\s]+([^\s]+).+", line)
if matcher and matcher.group(1) != "IP":
boxes.append(matcher.group(1))
diff --git a/contrib/inventory/foreman.py b/contrib/inventory/foreman.py
index b21ca11be8..a83c094d95 100755
--- a/contrib/inventory/foreman.py
+++ b/contrib/inventory/foreman.py
@@ -264,7 +264,7 @@ class ForemanInventory(object):
>>> ForemanInventory.to_safe("foo-bar baz")
'foo_barbaz'
'''
- regex = "[^A-Za-z0-9\_]"
+ regex = r"[^A-Za-z0-9\_]"
return re.sub(regex, "_", word.replace(" ", ""))
def update_cache(self):
diff --git a/contrib/inventory/linode.py b/contrib/inventory/linode.py
index 0784b35d7b..0472ecfce0 100755
--- a/contrib/inventory/linode.py
+++ b/contrib/inventory/linode.py
@@ -338,7 +338,7 @@ class LinodeInventory(object):
def to_safe(self, word):
"""Escapes any characters that would be invalid in an ansible group name."""
- return re.sub("[^A-Za-z0-9\-]", "_", word)
+ return re.sub(r"[^A-Za-z0-9\-]", "_", word)
def json_format_dict(self, data, pretty=False):
"""Converts a dict to a JSON object and dumps it as a formatted string."""
diff --git a/contrib/inventory/packet_net.py b/contrib/inventory/packet_net.py
index 583ba04cf0..0b1a1f5730 100755
--- a/contrib/inventory/packet_net.py
+++ b/contrib/inventory/packet_net.py
@@ -480,9 +480,9 @@ class PacketInventory(object):
def to_safe(self, word):
''' Converts 'bad' characters in a string to underscores so they can be used as Ansible groups '''
- regex = "[^A-Za-z0-9\_"
+ regex = r"[^A-Za-z0-9\_"
if not self.replace_dash_in_groups:
- regex += "\-"
+ regex += r"\-"
return re.sub(regex + "]", "_", word)
def json_format_dict(self, data, pretty=False):
diff --git a/contrib/inventory/rax.py b/contrib/inventory/rax.py
index a9e1be054b..0d0c7b63fd 100755
--- a/contrib/inventory/rax.py
+++ b/contrib/inventory/rax.py
@@ -189,7 +189,7 @@ p = load_config_file()
def rax_slugify(value):
- return 'rax_%s' % (re.sub('[^\w-]', '_', value).lower().lstrip('_'))
+ return 'rax_%s' % (re.sub(r'[^\w-]', '_', value).lower().lstrip('_'))
def to_dict(obj):
diff --git a/contrib/inventory/rudder.py b/contrib/inventory/rudder.py
index 50f1caeaaa..30cab1a21d 100755
--- a/contrib/inventory/rudder.py
+++ b/contrib/inventory/rudder.py
@@ -292,7 +292,7 @@ class RudderInventory(object):
''' Converts 'bad' characters in a string to underscores so they can be
used as Ansible variable names '''
- return re.sub('[^A-Za-z0-9\_]', '_', word)
+ return re.sub(r'[^A-Za-z0-9\_]', '_', word)
# Run the script
RudderInventory()
diff --git a/contrib/inventory/softlayer.py b/contrib/inventory/softlayer.py
index b1e915f74a..4bece43475 100755
--- a/contrib/inventory/softlayer.py
+++ b/contrib/inventory/softlayer.py
@@ -91,7 +91,7 @@ class SoftLayerInventory(object):
def to_safe(self, word):
'''Converts 'bad' characters in a string to underscores so they can be used as Ansible groups'''
- return re.sub("[^A-Za-z0-9\-\.]", "_", word)
+ return re.sub(r"[^A-Za-z0-9\-\.]", "_", word)
def push(self, my_dict, key, element):
'''Push an element onto an array that may not have been defined in the dict'''
diff --git a/contrib/inventory/vagrant.py b/contrib/inventory/vagrant.py
index 37a6741b09..c6e0ff3b75 100755
--- a/contrib/inventory/vagrant.py
+++ b/contrib/inventory/vagrant.py
@@ -79,7 +79,7 @@ def list_running_boxes():
boxes = []
for line in output:
- matcher = re.search("([^\s]+)[\s]+running \(.+", line)
+ matcher = re.search(r"([^\s]+)[\s]+running \(.+", line)
if matcher:
boxes.append(matcher.group(1))
diff --git a/contrib/inventory/windows_azure.py b/contrib/inventory/windows_azure.py
index 5398b54032..2e32e75204 100755
--- a/contrib/inventory/windows_azure.py
+++ b/contrib/inventory/windows_azure.py
@@ -271,7 +271,7 @@ class AzureInventory(object):
def to_safe(self, word):
"""Escapes any characters that would be invalid in an ansible group name."""
- return re.sub("[^A-Za-z0-9\-]", "_", word)
+ return re.sub(r"[^A-Za-z0-9\-]", "_", word)
def json_format_dict(self, data, pretty=False):
"""Converts a dict to a JSON object and dumps it as a formatted string."""