Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
The container registry cleanup task is now completed and the registry can be used normally.
Open sidebar
dcdb
dcdb
Commits
b4dea9a0
Commit
b4dea9a0
authored
Apr 19, 2016
by
Axel Auweter
Browse files
Add preliminary web gui (under development).
parent
f9932899
Changes
3
Hide whitespace changes
Inline
Side-by-side
DCDBTools/dcdbconfig/dcdbconfig.cpp
View file @
b4dea9a0
...
@@ -27,9 +27,42 @@ void usage(int argc, char* argv[])
...
@@ -27,9 +27,42 @@ void usage(int argc, char* argv[])
int
main
(
int
argc
,
char
*
argv
[])
int
main
(
int
argc
,
char
*
argv
[])
{
{
/* Check if run from command line */
int
argcReal
;
char
**
argvReal
;
if
(
isatty
(
fileno
(
stdin
)))
{
argcReal
=
argc
;
argvReal
=
(
char
**
)
argv
;
}
else
{
/* Check if we are a CGI program */
if
(
!
getenv
(
"QUERY_STRING"
))
{
std
::
cout
<<
"No terminal and no QUERY_STRING environment variable."
<<
std
::
endl
;
std
::
cout
<<
"Exiting."
<<
std
::
endl
;
exit
(
EXIT_FAILURE
);
}
/* Print content type */
std
::
cout
<<
"Content-type: text/plain"
<<
std
::
endl
<<
std
::
endl
;
/* Create argcReal and argvReal */
argcReal
=
1
;
argvReal
=
(
char
**
)
malloc
(
sizeof
(
char
*
));
argvReal
[
0
]
=
strdup
(
"dcdbconfig"
);
/* dummy to make consistent with command line invocation */
char
*
token
=
strtok
(
getenv
(
"QUERY_STRING"
),
"&"
);
while
(
token
)
{
argcReal
++
;
argvReal
=
(
char
**
)
realloc
((
void
*
)
argvReal
,
argcReal
*
sizeof
(
char
*
));
/* FIXME: should check if argvReal is NULL */
argvReal
[
argcReal
-
1
]
=
token
;
token
=
strtok
(
NULL
,
"&"
);
}
}
/* Check command line parameters */
/* Check command line parameters */
if
(
argc
<
2
)
{
if
(
argc
Real
<
2
)
{
usage
(
argc
,
argv
);
usage
(
argc
Real
,
argv
Real
);
exit
(
EXIT_FAILURE
);
exit
(
EXIT_FAILURE
);
}
}
...
@@ -39,49 +72,49 @@ int main(int argc, char* argv[])
...
@@ -39,49 +72,49 @@ int main(int argc, char* argv[])
host
=
"localhost"
;
host
=
"localhost"
;
}
}
while
((
ret
=
getopt
(
argc
,
argv
,
"+h:"
))
!=-
1
)
{
while
((
ret
=
getopt
(
argc
Real
,
argv
Real
,
"+h:"
))
!=-
1
)
{
switch
(
ret
)
{
switch
(
ret
)
{
case
'h'
:
case
'h'
:
host
=
optarg
;
host
=
optarg
;
break
;
break
;
default:
default:
usage
(
argc
,
argv
);
usage
(
argc
Real
,
argv
Real
);
exit
(
EXIT_FAILURE
);
exit
(
EXIT_FAILURE
);
}
}
}
}
if
(
optind
>=
argc
)
{
if
(
optind
>=
argc
Real
)
{
std
::
cout
<<
"Missing command!"
<<
std
::
endl
;
std
::
cout
<<
"Missing command!"
<<
std
::
endl
;
usage
(
argc
,
argv
);
usage
(
argc
Real
,
argv
Real
);
exit
(
EXIT_FAILURE
);
exit
(
EXIT_FAILURE
);
}
}
/* Process user command */
/* Process user command */
if
(
strcasecmp
(
argv
[
optind
],
"help"
)
==
0
)
{
if
(
strcasecmp
(
argv
Real
[
optind
],
"help"
)
==
0
)
{
/* Help is special: either we do general usage or we trigger the class factory and run the printHelp() function */
/* Help is special: either we do general usage or we trigger the class factory and run the printHelp() function */
if
(
optind
+
1
>=
argc
)
{
if
(
optind
+
1
>=
argc
Real
)
{
usage
(
argc
,
argv
);
usage
(
argc
Real
,
argv
Real
);
}
}
else
{
else
{
auto
action
=
UserActionFactory
::
getAction
(
argv
[
optind
+
1
]);
auto
action
=
UserActionFactory
::
getAction
(
argv
Real
[
optind
+
1
]);
if
(
action
)
{
if
(
action
)
{
action
->
printHelp
(
argc
,
argv
);
action
->
printHelp
(
argc
Real
,
argv
Real
);
}
}
else
{
else
{
std
::
cout
<<
"Cannot provide help for unknown command: "
<<
argv
[
optind
+
1
]
<<
std
::
endl
;
std
::
cout
<<
"Cannot provide help for unknown command: "
<<
argv
Real
[
optind
+
1
]
<<
std
::
endl
;
exit
(
EXIT_FAILURE
);
exit
(
EXIT_FAILURE
);
}
}
}
}
}
}
else
{
else
{
/* If the command is not help, we try to instantiate the respective class through the factory and process the command */
/* If the command is not help, we try to instantiate the respective class through the factory and process the command */
auto
action
=
UserActionFactory
::
getAction
(
argv
[
optind
]);
auto
action
=
UserActionFactory
::
getAction
(
argv
Real
[
optind
]);
if
(
action
)
{
if
(
action
)
{
return
action
->
executeCommand
(
argc
,
argv
,
optind
,
host
);
return
action
->
executeCommand
(
argc
Real
,
argv
Real
,
optind
,
host
);
}
}
else
{
else
{
std
::
cout
<<
"Unknwon command: "
<<
argv
[
1
]
<<
std
::
endl
;
std
::
cout
<<
"Unknwon command: "
<<
argv
Real
[
1
]
<<
std
::
endl
;
usage
(
argc
,
argv
);
usage
(
argc
Real
,
argv
Real
);
exit
(
EXIT_FAILURE
);
exit
(
EXIT_FAILURE
);
}
}
}
}
...
...
DCDBTools/dcdbquery/dcdbquery.cpp
View file @
b4dea9a0
...
@@ -61,7 +61,7 @@ int main(int argc, char * const argv[])
...
@@ -61,7 +61,7 @@ int main(int argc, char * const argv[])
}
}
/* Print content type */
/* Print content type */
std
::
cout
<<
"Content-type: text/
html
"
<<
std
::
endl
<<
std
::
endl
;
std
::
cout
<<
"Content-type: text/
plain
"
<<
std
::
endl
<<
std
::
endl
;
/* Create argcReal and argvReal */
/* Create argcReal and argvReal */
argcReal
=
1
;
argcReal
=
1
;
...
...
Makefile
View file @
b4dea9a0
...
@@ -2,7 +2,7 @@ MAKEFILENAME := $(lastword $(MAKEFILE_LIST))
...
@@ -2,7 +2,7 @@ MAKEFILENAME := $(lastword $(MAKEFILE_LIST))
include
config.mk
include
config.mk
LIBRARIES
=
DCDBLib
LIBRARIES
=
DCDBLib
PROJECTS
=
FilePusher SysFsPusher CollectAgent ParastationProvider IPMIPusher MontBlancPusher SNMPPusher DCDBTools scripts
PROJECTS
=
FilePusher SysFsPusher CollectAgent ParastationProvider IPMIPusher MontBlancPusher SNMPPusher DCDBTools scripts
webgui
CASSANDRA_VERSION
=
2.2.5
CASSANDRA_VERSION
=
2.2.5
MOSQUITTO_VERSION
=
1.3.5
MOSQUITTO_VERSION
=
1.3.5
...
@@ -311,6 +311,8 @@ $(DCDBDEPSPATH)/.prerequesites: $(DCDBDEPSPATH)/.extract-distfiles
...
@@ -311,6 +311,8 @@ $(DCDBDEPSPATH)/.prerequesites: $(DCDBDEPSPATH)/.extract-distfiles
sed
-i
-e
's/#LoadModule\ cgid_module.*/LoadModule\ cgid_module\ modules\/mod_cgid.so/'
$(DCDBDEPLOYPATH)
/conf/httpd.conf
;
\
sed
-i
-e
's/#LoadModule\ cgid_module.*/LoadModule\ cgid_module\ modules\/mod_cgid.so/'
$(DCDBDEPLOYPATH)
/conf/httpd.conf
;
\
echo
" Setting symlink for dcdbquery..."
;
\
echo
" Setting symlink for dcdbquery..."
;
\
ln
-s
$(DCDBDEPLOYPATH)
/bin/dcdbquery
$(DCDBDEPLOYPATH)
/cgi-bin/
;
\
ln
-s
$(DCDBDEPLOYPATH)
/bin/dcdbquery
$(DCDBDEPLOYPATH)
/cgi-bin/
;
\
echo
" Setting symlink for dcdbconfig..."
;
\
ln
-s
$(DCDBDEPLOYPATH)
/bin/dcdbconfig
$(DCDBDEPLOYPATH)
/cgi-bin/
;
\
echo
" Adding cgi-bin SymLinksIfOwnerMatch option..."
;
\
echo
" Adding cgi-bin SymLinksIfOwnerMatch option..."
;
\
sed
-i
-e
'/<Directory.*cgi-bin.>/,/<\/Directory>/ s/Options.*/Options\ SymLinksIfOwnerMatch/'
$(DCDBDEPLOYPATH)
/conf/httpd.conf
;
\
sed
-i
-e
'/<Directory.*cgi-bin.>/,/<\/Directory>/ s/Options.*/Options\ SymLinksIfOwnerMatch/'
$(DCDBDEPLOYPATH)
/conf/httpd.conf
;
\
touch
$(DCDBDEPSPATH)
/
$(H)
/.installed
;
\
touch
$(DCDBDEPSPATH)
/
$(H)
/.installed
;
\
...
...
Write
Preview
Supports
Markdown
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