# Buggy code
def _get_include_path(self, arg):
    """Converts an Apache Include directive into Augeas path.

    Converts an Apache Include directive argument into an Augeas
    searchable path

    .. todo:: convert to use os.path.join()

    :param str arg: Argument of Include directive

    :returns: Augeas path string
    :rtype: str

    """
    # Check to make sure only expected characters are used <- maybe remove
    # validChars = re.compile("[a-zA-Z0-9.*?_-/]*")
    # matchObj = validChars.match(arg)
    # if matchObj.group() != arg:
    #     logger.error("Error: Invalid regexp characters in %s", arg)
    #     return []

    # Remove beginning and ending quotes
    arg = arg.strip("'\"")

    # Standardize the include argument based on server root
    if not arg.startswith("/"):
        # Normpath will condense ../
        arg = os.path.normpath(os.path.join(self.root, arg))
    else:
        arg = os.path.normpath(arg)

    # Attempts to add a transform to the file if one does not already exist
    if os.path.isdir(arg):
        self._parse_file(os.path.join(arg, "*"))
    else:
        self._parse_file(arg)

    # Argument represents an fnmatch regular expression, convert it
    # Split up the path and convert each into an Augeas accepted regex
    # then reassemble
    split_arg = arg.split("/")
    for idx, split in enumerate(split_arg):
        if any(char in ApacheParser.fnmatch_chars for char in split):
            # Turn it into a augeas regex
            # TODO: Can this instead be an augeas glob instead of regex
            split_arg[idx] = "* [label()=~regexp('%s')]" % self.fnmatch_to_re(split)
    # Reassemble the argument
    # Note: This also normalizes the argument /serverroot/ -> /serverroot
    arg = "/".join(split_arg)

    return get_aug_path(arg)


# Traceback (PluginError)
Cannot find a cert or key directive in /files/etc/apache2/sites-available/default-ssl.conf/IfModule/VirtualHost. VirtualHost was not modified
Encountered exception:
Traceback (most recent call last):
File "/home/bmw/src/certbot/certbot/client.py", line 439, in deploy_certificate
fullchain_path=fullchain_path)
File "/home/bmw/src/certbot/certbot-apache/certbot_apache/configurator.py", line 269, in deploy_cert
"Unable to find cert and/or key directives")
PluginError: Unable to find cert and/or key directives

Calling registered functions
Reporting to user: Unable to install the certificate
Exiting abnormally:
Traceback (most recent call last):
File "/usr/local/bin/certbot", line 11, in <module>
load_entry_point('certbot', 'console_scripts', 'certbot')()
File "/home/bmw/src/certbot/certbot/main.py", line 743, in main
return config.func(config, plugins)
File "/home/bmw/src/certbot/certbot/main.py", line 604, in run
_install_cert(config, le_client, domains, new_lineage)
File "/home/bmw/src/certbot/certbot/main.py", line 469, in _install_cert
path_provider.cert_path, path_provider.chain_path, path_provider.fullchain_path)
File "/home/bmw/src/certbot/certbot/client.py", line 439, in deploy_certificate
fullchain_path=fullchain_path)
File "/home/bmw/src/certbot/certbot-apache/certbot_apache/configurator.py", line 269, in deploy_cert
"Unable to find cert and/or key directives")
PluginError: Unable to find cert and/or key directives

# Fixed code
def _get_include_path(self, arg):
    """Converts an Apache Include directive into Augeas path.

    Converts an Apache Include directive argument into an Augeas
    searchable path

    .. todo:: convert to use os.path.join()

    :param str arg: Argument of Include directive

    :returns: Augeas path string
    :rtype: str

    """
    # Check to make sure only expected characters are used <- maybe remove
    # validChars = re.compile("[a-zA-Z0-9.*?_-/]*")
    # matchObj = validChars.match(arg)
    # if matchObj.group() != arg:
    #     logger.error("Error: Invalid regexp characters in %s", arg)
    #     return []

    # Remove beginning and ending quotes
    arg = arg.strip("'\"")

    # Standardize the include argument based on server root
    if not arg.startswith("/"):
        # Normpath will condense ../
        arg = os.path.normpath(os.path.join(self.root, arg))
    else:
        arg = os.path.normpath(arg)

    # Attempts to add a transform to the file if one does not already exist
    if os.path.isdir(arg):
        self.parse_file(os.path.join(arg, "*"))
    else:
        self.parse_file(arg)

    # Argument represents an fnmatch regular expression, convert it
    # Split up the path and convert each into an Augeas accepted regex
    # then reassemble
    split_arg = arg.split("/")
    for idx, split in enumerate(split_arg):
        if any(char in ApacheParser.fnmatch_chars for char in split):
            # Turn it into a augeas regex
            # TODO: Can this instead be an augeas glob instead of regex
            split_arg[idx] = "* [label()=~regexp('%s')]" % self.fnmatch_to_re(split)
    # Reassemble the argument
    # Note: This also normalizes the argument /serverroot/ -> /serverroot
    arg = "/".join(split_arg)

    return get_aug_path(arg)