Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
P
pve-manager
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Administrator
pve-manager
Commits
80505f53
Commit
80505f53
authored
Dec 06, 2013
by
Stefan Priebe
Committed by
Dietmar Maurer
Dec 09, 2013
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
support to execute multiple commands in one request
parent
b96fb223
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
54 additions
and
0 deletions
+54
-0
Nodes.pm
PVE/API2/Nodes.pm
+54
-0
No files found.
PVE/API2/Nodes.pm
View file @
80505f53
...
...
@@ -110,6 +110,7 @@ __PACKAGE__->register_method ({
my
$result
=
[
{
name
=>
'
apt
'
},
{
name
=>
'
version
'
},
{
name
=>
'
execute
'
},
{
name
=>
'
syslog
'
},
{
name
=>
'
bootlog
'
},
{
name
=>
'
status
'
},
...
...
@@ -328,6 +329,59 @@ __PACKAGE__->register_method({
return
$res
;
}});
__PACKAGE__
->
register_method
({
name
=>
'
execute
',
path
=>
'
execute
',
method
=>
'
GET
',
permissions
=>
{
check
=>
['
perm
',
'
/nodes/{node}
',
[
'
Sys.Audit
'
]],
},
description
=>
"
Execute commands in order
",
proxyto
=>
'
node
',
parameters
=>
{
additionalProperties
=>
0
,
properties
=>
{
node
=>
get_standard_option
('
pve-node
'),
commands
=>
{
type
=>
"
JSON_STRING
"
}
},
},
returns
=>
{
type
=>
'
array
',
properties
=>
{
},
},
code
=>
sub
{
my
(
$param
)
=
@_
;
my
$res
=
[]
;
my
$commands
=
eval
{
decode_json
(
$param
->
{
commands
});
};
die
"
commands param did not contain valid JSON: $@
"
if
$@
;
die
"
commands is not an array
"
if
ref
(
$commands
)
ne
"
ARRAY
";
foreach
my
$cmd
(
@$commands
)
{
die
"
$cmd
is not a valid command
"
if
(
ref
(
$cmd
)
ne
"
HASH
"
||
!
$cmd
->
{
path
}
||
!
$cmd
->
{
method
});
$cmd
->
{
args
}
//
=
{};
my
$path
=
"
nodes/
"
.
$param
->
{
node
}
.
"
/
"
.
$cmd
->
{
path
};
my
(
$handler
,
$info
)
=
PVE::
API2
->
find_handler
(
$cmd
->
{
method
},
$path
,
$cmd
->
{
args
});
if
(
!
$handler
||
!
$info
)
{
die
"
no handler for '
$path
'
\n
";
}
eval
{
push
(
@$res
,
$handler
->
handle
(
$info
,
$cmd
->
{
args
})
);
};
push
(
@$res
,
$@
)
if
$@
;
}
return
$res
;
}});
__PACKAGE__
->
register_method
({
name
=>
'
node_cmd
',
path
=>
'
status
',
...
...
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