How to use the errbot.arg_botcmd function in errbot

To help you get started, we’ve selected a few errbot examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github errbotio / errbot / tests / base_backend_tests.py View on Github external
    @arg_botcmd('--last-name', dest='last_name', unpack_args=False)
    def returns_first_name_last_name_without_unpacking(self, mess, args):
        return "%s %s" % (args.first_name, args.last_name)
github errbotio / errbot / tests / base_backend_tests.py View on Github external
    @arg_botcmd('value', type=str)
    @arg_botcmd('--count', dest='count', type=int)
    def returns_value_repeated_count_times(self, mess, value=None, count=None):
        # str * int gives a repeated string
        return value * count
github errbotio / errbot / tests / base_backend_tests.py View on Github external
    @arg_botcmd('--first-name', dest='first_name')
    @arg_botcmd('--last-name', dest='last_name')
    def returns_first_name_last_name(self, mess, first_name=None, last_name=None):
        return "%s %s" % (first_name, last_name)
github MattHodge / WindowsErrbot / plugins / psremote / psremote.py View on Github external
    @arg_botcmd('--port', dest='port', type=int, default=5985)
    @arg_botcmd('--ensure', dest='ensure', type=str, default='Present')
    def dscfeature(self, message, computername=None, port=None, ensure=None, feature_name=None):
        """Install DSC Features Remotley"""

        ps_script = """
            $VerbosePreference="Continue"

            $splat = @{{
                Name = 'WindowsFeature'
                Method = 'Set'
                Property = @{{
                    Name = '{feature_name}'
                    Ensure = '{ensure}'
                }}
                ModuleName = 'PSDesiredStateConfiguration'
                Verbose = $true
github br0ziliy / err-ansible / ansible.py View on Github external
    @arg_botcmd('--variables', dest='variables', type=str, nargs=argparse.REMAINDER, default=None,
                help="optional playbook variables")
    @arg_botcmd('--timeout', dest='timeout', type=int, default=180,
                help="Timeout for playbook execution")
    @arg_botcmd('inventory', type=str,
                help="filename of the inventory file")
    @arg_botcmd('playbook', type=str,
                help="filename of the playbook file")
    def ansible(self, mess, inventory=None, playbook=None, timeout=None,
                variables=None):
        """
        Runs specified Ansible playbook on the specific inventory
        """

        _from = mess
        inventory_file = "/".join([self.config['INVENTORY_DIR'], inventory])
        playbook_file = "/".join([self.config['PLAYBOOK_DIR'], playbook])
github MattHodge / WindowsErrbot / plugins / psremote / psremote.py View on Github external
    @arg_botcmd('--ensure', dest='ensure', type=str, default='Present')
    def dscfeature(self, message, computername=None, port=None, ensure=None, feature_name=None):
        """Install DSC Features Remotley"""

        ps_script = """
            $VerbosePreference="Continue"

            $splat = @{{
                Name = 'WindowsFeature'
                Method = 'Set'
                Property = @{{
                    Name = '{feature_name}'
                    Ensure = '{ensure}'
                }}
                ModuleName = 'PSDesiredStateConfiguration'
                Verbose = $true
            }}
github MattHodge / WindowsErrbot / plugins / psremote / psremote.py View on Github external
    @arg_botcmd('--port', dest='port', type=int, default=5985)
    def stopsvc(self, message, computername=None, service_name=None, port=None):
        """Stop Service over WinRM"""

        ps_script = "Stop-Service -Name %s" % service_name

        cmd_output = run_remote_ps(computername, port, 'vagrant', 'vagrant', ps_script)

        if cmd_output['exit_code'] == 0:
            yield ":white_check_mark: Service \`{service_name}\` has been stopped on \`{computername}\`".format(
                service_name=service_name,
                computername=computername
            )
        else:
            yield ":x: Unable to stop \`{service_name}\` on \`{computername}\`".format(
                service_name=service_name,
                computername=computername
github fleeto / issueflow / errbot-plugin / transbot / transbot.py View on Github external
    @arg_botcmd("--milestone", type=str)
    def label_to_milestone(self, msg, label, milestone):
        trans = self._translation_util(msg)
        count = trans.set_milestone_by_label(REPOSITORY_NAME,
                                             [label], milestone)
        return "{} issues had been moved into the milestone {}".format(
            count, milestone
        )
github fleeto / issueflow / errbot-plugin / transbot / transbot.py View on Github external
    @arg_botcmd('branch', type=str)
    @arg_botcmd('--create_issue', type=int, default=0)
    def find_new_files_in(self, msg, branch, create_issue):
        """
        Find new files from a branch for a language.
        :param msg:
        :param branch:
        :param create_issue: if its value is
        0 (default), will only show the new files.
        else it will create new issue for them.
        :return:
        """
        self._asset_bind(msg)
        trans = self._translation_util(msg)
        new_file_list = trans.find_new_files(
            REPOSITORY_NAME, branch, TARGET_LANG)
github errbotio / errbot / errbot / core_plugins / health.py View on Github external
    @arg_botcmd('--confirm', dest="confirmed", action="store_true",
                help="confirm you want to shut down", admin_only=True)
    @arg_botcmd('--kill', dest="kill", action="store_true",
                help="kill the bot instantly, don't shut down gracefully", admin_only=True)
    def shutdown(self, msg, confirmed, kill):
        """
        Shutdown the bot.

        Useful when the things are going crazy and you don't have access to the machine.
        """
        if not confirmed:
            yield "Please provide `--confirm` to confirm you really want me to shut down."
            return

        if kill:
            yield "Killing myself right now!"
            os.kill(os.getpid(), signal.SIGKILL)