Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
W
Warden
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
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
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Pavel Valach
Warden
Commits
39393802
Commit
39393802
authored
12 years ago
by
Tomáš Plesník
Browse files
Options
Downloads
Patches
Plain Diff
odstranen WardenConf, pridan WardenCommon
parent
d90ec03d
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/warden-server/lib/WardenCommon.pm
+67
-0
67 additions, 0 deletions
src/warden-server/lib/WardenCommon.pm
src/warden-server/lib/WardenConf.pm
+0
-38
0 additions, 38 deletions
src/warden-server/lib/WardenConf.pm
with
67 additions
and
38 deletions
src/warden-server/lib/WardenCommon.pm
0 → 100755
+
67
−
0
View file @
39393802
#!/usr/bin/perl -w
#
# WardenCommon.pm
#
# Copyright (C) 2011-2013 Cesnet z.s.p.o
#
# Use of this source is governed by a BSD-style license, see LICENSE file.
package
WardenCommon
;
use
strict
;
use
File::
Basename
;
use
Sys::
Syslog
qw(:DEFAULT setlogsock)
;
Sys::Syslog::
setlogsock
('
unix
');
use
Carp
;
our
$VERSION
=
"
2.2
";
#-------------------------------------------------------------------------------
# errMsg - print error message and die
#-------------------------------------------------------------------------------
sub
errMsg
{
my
$msg
=
shift
;
$msg
=
trim
(
$msg
);
print
$msg
.
"
\n
";
exit
1
;
}
# End of errMsg
#-------------------------------------------------------------------------------
# trim - remove whitespace from the start and end of the string
#-------------------------------------------------------------------------------
sub
trim
{
my
$string
=
shift
;
$string
=~
s/^\s+//
;
$string
=~
s/\s+$//
;
return
$string
;
}
# End of trim
#-------------------------------------------------------------------------------
# sendMsg - sent message to syslog (SYS::Syslog)
#-------------------------------------------------------------------------------
sub
sendMsg
{
my
$syslog
=
shift
;
my
$syslog_verbose
=
shift
;
my
$syslog_facility
=
shift
;
my
$severity
=
shift
;
my
$syslog_msg
=
shift
;
my
$filename
=
File::Basename::
basename
(
$
0
);
if
(
$syslog_verbose
==
1
&&
(
$severity
eq
"
err
"
||
$severity
eq
"
debug
"))
{
$syslog_msg
.=
"
\n
Stack info:
"
.
Carp::
longmess
();
}
if
(
$syslog
==
1
&&
defined
$severity
&&
defined
$syslog_msg
)
{
Sys::Syslog::
openlog
(
$filename
,
"
cons,pid
",
$syslog_facility
);
Sys::Syslog::
syslog
("
$severity
",
"
$syslog_msg
");
Sys::Syslog::
closelog
();
}
}
# End of sendMsg
1
;
This diff is collapsed.
Click to expand it.
src/warden-server/lib/WardenConf.pm
deleted
100755 → 0
+
0
−
38
View file @
d90ec03d
#!/usr/bin/perl -w
#
# WardenConf.pm
#
# Copyright (C) 2011-2013 Cesnet z.s.p.o
#
# Use of this source is governed by a BSD-style license, see LICENSE file.
package
WardenConf
;
use
strict
;
our
$VERSION
=
"
2.0
";
#-------------------------------------------------------------------------------
# loadConf - load variables from configuration file
#-------------------------------------------------------------------------------
sub
loadConf
{
my
$conf_file
=
shift
;
# preset of default variables
our
$URI
=
undef
;
our
$SSL_KEY_FILE
=
undef
;
our
$SSL_CERT_FILE
=
undef
;
our
$SSL_CA_FILE
=
undef
;
# load set variables by user
unless
(
do
$conf_file
)
{
die
("
Errors in config file '
$conf_file
': $@
")
if
$@
;
die
("
Can't read config file '
$conf_file
': $!
")
unless
defined
$_
;
# if $_ defined, it's retvalue of last statement of conf, for which we don't care
}
return
(
$URI
,
$SSL_KEY_FILE
,
$SSL_CERT_FILE
,
$SSL_CA_FILE
);
}
# End of loadConf
1
;
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment