Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Serverside actions and cli #1823

Open
wants to merge 29 commits into
base: develop
Choose a base branch
from
Open

Conversation

sadnub
Copy link
Collaborator

@sadnub sadnub commented Apr 2, 2024

No description provided.

@sadnub
Copy link
Collaborator Author

sadnub commented Apr 2, 2024

TODO/BUGS:

  • username missing top right
  • fix migrations (merge conflict)
  • crontab not being set
  • manually trying to run server side task (from global settings context menu) gives 500 error, frontend error Unable to run task: [object Object]
  • tools > bulk doesn't load, check console for error
  • permissions for web terminal
  • htop/top etc not working in web terminal in prod.
  • repeating characters in web terminal not working (type aaaa or bbbb or spam backspace) the fix is to move this into its own consumer, do not share with dash_info as the sleep is messing it up
  • move webhooks to their own UI (confusing because it's currently inside URL actions)
  • server script output doesn't show up in the alert manager like the regular scripts do
  • @sadnub figure out icon bug -use another icon if can't resolve
  • alert failure/resolved args/env vars not being saved
  • when creating new webhook, body of json is not being properly applied when switching between headers and body tab. fixed in amidaware/tacticalrmm-web@08edca4
  • hide and disable "Server Tasks" in global settings as this is not fully implemented
  • @wh1te909 handle "Timeout must be 60 or less" for server tasks
  • TOTP web UI setup broken Uncaught TypeError: Cannot read properties of undefined (reading 'then') at Proxy.logout (TOTPSetup.vue:79:9)
  • @wh1te909 Add auditing to new views and functions
  • Revert AddAutomatedTask.vue to previous version before rework
  • @wh1te909 Ensure webhook urls are encoded. Add test case.
  • @sadnub Add request body to the Test Webhooks modal
  • @sadnub Add loading indicator and error handling for Test Webhooks
  • Test web hooks feature does not substitute any variables, just None for everything. For example testing with {{agent.hostname}} returns None
  • Serverside actions and cli #1823 (comment)
  • Serverside actions and cli #1823 (comment)
  • @sadnub Alert webhook should not show up in agents context menu "Run Url Action" as well as in User Interface > URL Action
  • @wh1te909 Make web terminal open in new window, similar to remote background
  • @wh1te909 @dinger1986 @silversword411 Regression test all code that was reworked
  • @wh1te909 Add global setting to optionally disable web terminal and server scripts

@silversword411
Copy link
Collaborator

Fix Pattern column, limit max length.
Change bottom scrollbar to always show
Test at browser with width 900

2024-04-22_142818 - chrome_Tactical_RMM_-_Google_Chromeb

@dinger1986
Copy link
Collaborator

dinger1986 commented Apr 22, 2024

When building out content for the webhook message ie "text": "Error on {{agent.hostname}} with severity of {{alert.severity}}, at {{alert.alert_time}}. The full content of the message is {{alert.message}}" it doesnt send more than the first variable, same behaviour with teams and slack

@dinger1986
Copy link
Collaborator

Errors Running more advanced webhooks

POST

Header

{
    "Content-Type": "application/json",
    "User-Agent": "TacticalRMM/1.0"
}

Body

{
    "@type": "MessageCard",
    "@context": "http://schema.org/extensions",
    "summary": "Issue with {{agent.hostname}}",
    "themeColor": "0078D7",
    "title": "{{alert.message}}",
    "sections": [{
        "activityTitle": "Issue",
        "activitySubtitle": "On {{alert.severity}}",
        "facts": [{
            "name": "Alert Time",
            "value": "{{alert.alert_time}}"
        }],
        "markdown": true
    }]
}

I have DM'd the URL

Error from debug log

[22/Apr/2024 22:22:51] ERROR [log.py:log_response:241] Internal Server Error: /core/urlaction/run/test/
Traceback (most recent call last):
  File "/rmm/api/env/lib/python3.11/site-packages/django/core/handlers/exception.py", line 55, in inner
    response = get_response(request)
               ^^^^^^^^^^^^^^^^^^^^^
  File "/rmm/api/env/lib/python3.11/site-packages/django/core/handlers/base.py", line 197, in _get_response
    response = wrapped_callback(request, *callback_args, **callback_kwargs)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/rmm/api/env/lib/python3.11/site-packages/django/views/decorators/csrf.py", line 56, in wrapper_view
    return view_func(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/rmm/api/env/lib/python3.11/site-packages/django/views/generic/base.py", line 104, in view
    return self.dispatch(request, *args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/rmm/api/env/lib/python3.11/site-packages/rest_framework/views.py", line 509, in dispatch
    response = self.handle_exception(exc)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/rmm/api/env/lib/python3.11/site-packages/rest_framework/views.py", line 469, in handle_exception
    self.raise_uncaught_exception(exc)
  File "/rmm/api/env/lib/python3.11/site-packages/rest_framework/views.py", line 480, in raise_uncaught_exception
    raise exc
  File "/rmm/api/env/lib/python3.11/site-packages/rest_framework/views.py", line 506, in dispatch
    response = handler(request, *args, **kwargs)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/rmm/api/tacticalrmm/core/views.py", line 454, in post
    result, _ = run_test_url_rest_action(
                ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/rmm/api/tacticalrmm/core/utils.py", line 308, in run_test_url_rest_action
    response = _run_url_rest_action(
               ^^^^^^^^^^^^^^^^^^^^^
  File "/rmm/api/tacticalrmm/core/utils.py", line 256, in _run_url_rest_action
    new_body = find_and_replace_db_values_dict(
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/rmm/api/tacticalrmm/core/utils.py", line 246, in find_and_replace_db_values_dict
    new_value = find_and_replace_db_values_str(text=value, instance=instance)
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/rmm/api/tacticalrmm/core/utils.py", line 225, in find_and_replace_db_values_str
    for string, model, prop in re.findall(RE_DB_VALUE, text):
                               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/re/__init__.py", line 216, in findall
    return _compile(pattern, flags).findall(string)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: expected string or bytes-like object, got 'list'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants