Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
diagnostics
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
This is an archived project. Repository and other project resources are read-only.
Show more breadcrumbs
ai3
tools
diagnostics
Merge requests
!1
"wp-content/mu-plugins/ai-common.php" did not exist on "ee791c96a4ce6143759348f74e084a8c39c1a524"
Add an XMPP probe
Code
Review changes
Check out branch
Download
Patches
Plain diff
Merged
Add an XMPP probe
xmpp
into
master
Overview
4
Commits
2
Pipelines
2
Changes
4
Merged
ale
requested to merge
xmpp
into
master
4 years ago
Overview
4
Commits
2
Pipelines
2
Changes
4
Expand
1
0
Merge request reports
Compare
master
version 1
7d1898f1
4 years ago
master (base)
and
latest version
latest version
45d0866e
2 commits,
4 years ago
version 1
7d1898f1
1 commit,
4 years ago
4 files
+
67
−
1
Inline
Compare changes
Side-by-side
Inline
Show whitespace changes
Show one file at a time
Files
4
Search (e.g. *.vue) (Ctrl+P)
ai_diagnostics/probes/xmpp.py
0 → 100644
+
35
−
0
Options
import
threading
import
time
from
ai_diagnostics
import
xmpp
TIMEOUT
=
30
def
probe_xmpp
(
ctx
):
bot
=
xmpp
.
SendMsgBot
(
ctx
[
'
credentials
'
][
'
username
'
],
ctx
[
'
credentials
'
][
'
password
'
])
bot
.
register_plugin
(
'
xep_0030
'
)
bot
.
register_plugin
(
'
xep_0199
'
)
# We can't reliably time out the XMPP probe on certain failures,
# so we just shut down the client altogether after a timeout.
done
=
threading
.
Event
()
def
_timeout
():
time
.
sleep
(
TIMEOUT
)
if
not
done
.
isSet
():
bot
.
disconnect
()
threading
.
Thread
(
target
=
_timeout
,
daemon
=
True
).
start
()
try
:
ctx
.
log
(
'
connecting to %s:5222
'
,
ctx
[
'
server
'
])
if
bot
.
connect
((
ctx
[
'
server
'
],
5222
),
reattempt
=
False
):
ctx
.
log
(
'
connection successful, setting presence
'
)
bot
.
process
(
block
=
True
)
ctx
.
log
(
'
disconnected successfully
'
)
else
:
ctx
.
log
(
'
unable to connect
'
)
finally
:
done
.
set
()
bot
.
disconnect
()
Loading