# Buggy code
def prepare(self):
    """
    Run the preparation sequence required to start a salt syndic minion.

    If sub-classed, don't **ever** forget to run:

        super(YourSubClass, self).prepare()
    """
    super(Syndic, self).prepare()
    try:
        if self.config["verify_env"]:
            verify_env(
                [
                    self.config["pki_dir"],
                    self.config["cachedir"],
                    self.config["sock_dir"],
                    self.config["extension_modules"],
                ],
                self.config["user"],
                permissive=self.config["permissive_pki_access"],
                pki_dir=self.config["pki_dir"],
            )
            logfile = self.config["log_file"]
            if logfile is not None and not logfile.startswith(
                ("tcp://", "udp://", "file://")
            ):
                # Logfile is not using Syslog, verify
                current_umask = os.umask(0o027)
                verify_files([logfile], self.config["user"])
                os.umask(current_umask)
    except OSError as err:
        logger.exception("Failed to prepare salt environment")
        self.shutdown(err.errno)

    self.setup_logfile_logger()
    verify_log(self.config)
    logger.info('Setting up the Salt Syndic Minion "{0}"'.format(self.config["id"]))

    # Late import so logging works correctly
    import salt.minion

    self.daemonize_if_required()
    # if its a multisyndic, do so
    if isinstance(self.config.get("master"), list):
        self.syndic = salt.minion.MultiSyndic(self.config)
    else:
        self.syndic = salt.minion.Syndic(self.config)
    self.set_pidfile()


# Traceback (optparse.OptionConflictError)
/usr/lib/python2.7/dist-packages/salt/utils/parsers.py:953: DeprecationWarning: Please stop sub-classing PidfileMix and instead subclass DaemonMixIn which contains the same behavior. PidfileMixin will be supported until Salt Nitrogen (Unreleased).
Traceback (most recent call last):
File "/usr/bin/salt-api", line 8, in <module>
salt_api()
File "/usr/lib/python2.7/dist-packages/salt/scripts.py", line 441, in salt_api
sapi = salt.cli.api.SaltAPI()  # pylint: disable=E1120
File "/usr/lib/python2.7/dist-packages/salt/utils/parsers.py", line 152, in __init__
optparse.OptionParser.__init__(self, *args, **kwargs)
File "/usr/lib/python2.7/optparse.py", line 1220, in __init__
add_help=add_help_option)
File "/usr/lib/python2.7/dist-packages/salt/utils/parsers.py", line 233, in _populate_option_list
mixin_setup_func(self)
File "/usr/lib/python2.7/dist-packages/salt/utils/parsers.py", line 962, in _mixin_setup
help=('Specify the location of the pidfile. Default: %default')
File "/usr/lib/python2.7/optparse.py", line 1021, in add_option
self._check_conflict(option)
File "/usr/lib/python2.7/optparse.py", line 996, in _check_conflict
option)
optparse.OptionConflictError: option --pid-file: conflicting option string(s): --pid-file

# Fixed code
def prepare(self):
    """
    Run the preparation sequence required to start a salt syndic minion.

    If sub-classed, don't **ever** forget to run:

        super(YourSubClass, self).prepare()
    """
    super(Syndic, self).prepare()
    try:
        if self.config["verify_env"]:
            verify_env(
                [
                    self.config["pki_dir"],
                    self.config["cachedir"],
                    self.config["sock_dir"],
                    self.config["extension_modules"],
                ],
                self.config["user"],
                permissive=self.config["permissive_pki_access"],
                pki_dir=self.config["pki_dir"],
            )
            logfile = self.config["log_file"]
            if logfile is not None and not logfile.startswith(
                ("tcp://", "udp://", "file://")
            ):
                # Logfile is not using Syslog, verify
                current_umask = os.umask(0o027)
                verify_files([logfile], self.config["user"])
                os.umask(current_umask)
    except OSError as err:
        log.exception("Failed to prepare salt environment")
        self.shutdown(err.errno)

    self.setup_logfile_logger()
    verify_log(self.config)
    log.info('Setting up the Salt Syndic Minion "{0}"'.format(self.config["id"]))

    # Late import so logging works correctly
    import salt.minion

    self.daemonize_if_required()
    # if its a multisyndic, do so
    if isinstance(self.config.get("master"), list):
        self.syndic = salt.minion.MultiSyndic(self.config)
    else:
        self.syndic = salt.minion.Syndic(self.config)
    self.set_pidfile()