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
3dc6e6c7
Commit
3dc6e6c7
authored
Apr 20, 2012
by
Dietmar Maurer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add option --nooutput
parent
6a92d3a1
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
24 additions
and
8 deletions
+24
-8
pvesh
bin/pvesh
+24
-8
No files found.
bin/pvesh
View file @
3dc6e6c7
...
...
@@ -37,13 +37,27 @@ sub print_usage {
}
my
$disable_proxy
=
0
;
my
$opt_nooutput
=
0
;
my
$cmd
=
shift
;
if
(
$cmd
&&
$cmd
eq
'
--noproxy
')
{
$cmd
=
shift
;
$disable_proxy
=
1
;
}
my
$optmatch
;
do
{
$optmatch
=
0
;
if
(
$cmd
)
{
if
(
$cmd
eq
'
--noproxy
')
{
$cmd
=
shift
;
$disable_proxy
=
1
;
$optmatch
=
1
;
}
elsif
(
$cmd
eq
'
--nooutput
')
{
# we use this when starting task in CLI (suppress printing upid)
# for example 'pvesh --nooutput create /nodes/localhost/stopall'
$cmd
=
shift
;
$opt_nooutput
=
1
;
$optmatch
=
1
;
}
}
}
while
(
$optmatch
);
if
(
$cmd
)
{
if
(
$cmd
eq
'
verifyapi
')
{
...
...
@@ -51,7 +65,7 @@ if ($cmd) {
exit
0
;
}
elsif
(
$cmd
eq
'
ls
'
||
$cmd
eq
'
get
'
||
$cmd
eq
'
create
'
||
$cmd
eq
'
set
'
||
$cmd
eq
'
delete
'
||
$cmd
eq
'
help
'
)
{
pve_command
([
$cmd
,
@ARGV
]);
pve_command
([
$cmd
,
@ARGV
]
,
$opt_nooutput
);
exit
(
0
);
}
else
{
print_usage
("
unknown command '
$cmd
'
");
...
...
@@ -237,7 +251,7 @@ sub proxy_handler {
}
sub
call_method
{
my
(
$dir
,
$cmd
,
$args
)
=
@_
;
my
(
$dir
,
$cmd
,
$args
,
$nooutput
)
=
@_
;
my
$method
=
map_cmd
(
$cmd
);
...
...
@@ -252,6 +266,8 @@ sub call_method {
my
$data
=
$handler
->
cli_handler
("
$cmd
$dir
",
$info
->
{
name
},
$args
,
[]
,
$uri_param
,
$read_password
);
return
if
$nooutput
;
warn
"
200 OK
\n
";
# always print OK status if successful
if
(
$info
&&
$info
->
{
returns
}
&&
$info
->
{
returns
}
->
{
type
})
{
...
...
@@ -430,7 +446,7 @@ sub list_dir {
sub
pve_command
{
my
$args
=
shift
;
my
(
$args
,
$nooutput
)
=
@_
;
PVE::Cluster::
cfs_update
();
...
...
@@ -501,7 +517,7 @@ sub pve_command {
$path
=
shift
@$args
;
}
call_method
(
abs_path
(
$cdir
,
$path
),
$cmd
,
$args
);
call_method
(
abs_path
(
$cdir
,
$path
),
$cmd
,
$args
,
$nooutput
);
}
elsif
(
$cmd
eq
'
delete
')
{
...
...
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