Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
FlockLab 1 - deprecated
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Operations
Operations
Incidents
Packages & Registries
Packages & Registries
Container Registry
Analytics
Analytics
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
TEC
P
Public
FlockLab
FlockLab 1 - deprecated
Commits
69e7b068
Commit
69e7b068
authored
Aug 07, 2019
by
Reto Da Forno
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
shell tool updated
parent
cab21cf4
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
47 additions
and
6 deletions
+47
-6
server/webserver/user/api.php
server/webserver/user/api.php
+36
-4
tools/shell-tool/flocklab
tools/shell-tool/flocklab
+11
-2
No files found.
server/webserver/user/api.php
View file @
69e7b068
...
...
@@ -19,16 +19,16 @@
LEFT JOIN `flocklab`.`tbl_serv_tg_adapt_types` AS slot4 ON d.tg_adapt_types_fk = slot4.serv_tg_adapt_types_key
WHERE obs.status='online'
ORDER BY obs.observer_id;"
;
$res
=
mysql
_query
(
$sql
);
$res
=
mysql
i_query
(
$db
,
$sql
);
if
(
!
$res
)
{
echo
json_encode
(
array
(
'status'
=>
'error'
,
'output'
=>
mysql
_error
(
)));
echo
json_encode
(
array
(
'status'
=>
'error'
,
'output'
=>
mysql
i_error
(
$db
)));
}
else
{
if
(
isset
(
$_POST
[
'platform'
]))
{
$platform
=
mysql
_real_escape_string
(
$_POST
[
'platform'
]);
$platform
=
mysql
i_real_escape_string
(
$db
,
$_POST
[
'platform'
]);
}
$output
=
""
;
while
(
$row
=
mysql_fetch_assoc
(
$res
))
{
while
(
$row
=
mysql
i
_fetch_assoc
(
$res
))
{
if
(
$platform
==
""
||
!
strcasecmp
(
$platform
,
$row
[
'name1'
])
||
!
strcasecmp
(
$platform
,
$row
[
'name2'
])
||
!
strcasecmp
(
$platform
,
$row
[
'name3'
])
||
!
strcasecmp
(
$platform
,
$row
[
'name4'
]))
{
$output
.
=
$row
[
'observer_id'
]
.
" "
;
}
...
...
@@ -36,6 +36,38 @@
echo
json_encode
(
array
(
'status'
=>
'ok'
,
'output'
=>
trim
(
$output
)));
}
}
else
if
(
$_POST
[
'q'
]
==
'platform'
)
{
$db
=
db_connect
();
$sql
=
"SELECT obs.observer_id, slot1.name AS name1, slot1.description AS desc1,
slot2.name AS name2, slot2.description AS desc2,
slot3.name AS name3, slot3.description AS desc3,
slot4.name AS name4, slot4.description AS desc4
FROM `flocklab`.`tbl_serv_observer` AS obs
LEFT JOIN `flocklab`.`tbl_serv_tg_adapt_list` AS a ON obs.slot_1_tg_adapt_list_fk = a.serv_tg_adapt_list_key
LEFT JOIN `flocklab`.`tbl_serv_tg_adapt_types` AS slot1 ON a.tg_adapt_types_fk = slot1.serv_tg_adapt_types_key
LEFT JOIN `flocklab`.`tbl_serv_tg_adapt_list` AS b ON obs.slot_2_tg_adapt_list_fk = b.serv_tg_adapt_list_key
LEFT JOIN `flocklab`.`tbl_serv_tg_adapt_types` AS slot2 ON b.tg_adapt_types_fk = slot2.serv_tg_adapt_types_key
LEFT JOIN `flocklab`.`tbl_serv_tg_adapt_list` AS c ON obs.slot_3_tg_adapt_list_fk = c.serv_tg_adapt_list_key
LEFT JOIN `flocklab`.`tbl_serv_tg_adapt_types` AS slot3 ON c.tg_adapt_types_fk = slot3.serv_tg_adapt_types_key
LEFT JOIN `flocklab`.`tbl_serv_tg_adapt_list` AS d ON obs.slot_4_tg_adapt_list_fk = d.serv_tg_adapt_list_key
LEFT JOIN `flocklab`.`tbl_serv_tg_adapt_types` AS slot4 ON d.tg_adapt_types_fk = slot4.serv_tg_adapt_types_key
WHERE obs.status='online'
ORDER BY obs.observer_id;"
;
$res
=
mysqli_query
(
$db
,
$sql
);
if
(
!
$res
)
{
echo
json_encode
(
array
(
'status'
=>
'error'
,
'output'
=>
mysqli_error
(
$db
)));
}
else
{
$output
=
[];
while
(
$row
=
mysqli_fetch_assoc
(
$res
))
{
$output
[]
=
$row
[
'name1'
];
$output
[]
=
$row
[
'name2'
];
$output
[]
=
$row
[
'name3'
];
$output
[]
=
$row
[
'name4'
];
}
echo
json_encode
(
array
(
'status'
=>
'ok'
,
'output'
=>
join
(
" "
,
array_unique
(
array_filter
(
$output
)))));
}
}
else
{
echo
json_encode
(
array
(
'status'
=>
'error'
,
'output'
=>
'unknown query'
));
}
...
...
tools/shell-tool/flocklab
View file @
69e7b068
...
...
@@ -13,6 +13,7 @@
# -g <testid>: get via https
# -f <testid>: fetch via webdav
# -o <platform>: get a list of the currently available (online) observers
# -p: get a list of the available platforms
# -h: display help
#
# Your FlockLab login credentials need to be stored in .flocklabauth in your home directory as follows:
...
...
@@ -66,7 +67,8 @@ OPTIONS:
-d <testid>: delete test
-g <testid>: get test results (via https)
-f <testid>: fetch test results (via webdav)
-o <platform>: get the list of currently available observers
-o <platform>: get a list of currently available observers
-p: get a list of available platforms
EOF
}
...
...
@@ -136,7 +138,7 @@ then
exit
1
fi
while
getopts
“v:c:a:d:f:g:o:h” OPTION
while
getopts
“v:c:a:d:f:g:o:
p
h” OPTION
do
case
$OPTION
in
v
)
...
...
@@ -280,6 +282,13 @@ do
echo
$RESPONSE
fi
;;
p
)
RESPONSE
=
`
curl
$CURL_PARAMS
-o
-
-F
username
=
"
$USER
"
-F
password
=
"
$PASSWORD
"
-F
q
=
"platform"
$SERVER_URL
/api.php
`
if
[
$?
-eq
0
]
then
echo
$RESPONSE
fi
;;
h
)
usage
exit
0
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment