Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
U
uniset2
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
1
Issues
1
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
UniSet project repositories
uniset2
Commits
9f0bf5d2
Commit
9f0bf5d2
authored
Sep 28, 2016
by
Pavel Vainerman
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
(Admin): подправил обработку ошибок
parent
412646b0
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
35 additions
and
14 deletions
+35
-14
admin.cc
Utilities/Admin/admin.cc
+35
-14
No files found.
Utilities/Admin/admin.cc
View file @
9f0bf5d2
...
...
@@ -41,8 +41,8 @@ static struct option longopts[] =
{
"start"
,
no_argument
,
0
,
's'
},
{
"finish"
,
no_argument
,
0
,
'f'
},
{
"foldUp"
,
no_argument
,
0
,
'u'
},
{
"configure"
,
required
_argument
,
0
,
'r'
},
{
"logrotate"
,
required
_argument
,
0
,
'l'
},
{
"configure"
,
optional
_argument
,
0
,
'r'
},
{
"logrotate"
,
optional
_argument
,
0
,
'l'
},
{
"info"
,
required_argument
,
0
,
'i'
},
{
"setValue"
,
required_argument
,
0
,
'x'
},
{
"getValue"
,
required_argument
,
0
,
'g'
},
...
...
@@ -184,7 +184,8 @@ int main(int argc, char** argv)
auto
conf
=
uniset_init
(
argc
,
argv
,
conffile
);
UInterface
ui
(
conf
);
ui
.
initBackId
(
UniSetTypes
::
AdminID
);
return
setValue
(
optarg
,
ui
);
string
name
=
(
optarg
)
?
optarg
:
""
;
return
setValue
(
name
,
ui
);
}
break
;
...
...
@@ -194,7 +195,8 @@ int main(int argc, char** argv)
auto
conf
=
uniset_init
(
argc
,
argv
,
conffile
);
UInterface
ui
(
conf
);
ui
.
initBackId
(
UniSetTypes
::
AdminID
);
return
getValue
(
optarg
,
ui
);
string
name
=
(
optarg
)
?
optarg
:
""
;
return
getValue
(
name
,
ui
);
}
break
;
...
...
@@ -204,7 +206,8 @@ int main(int argc, char** argv)
auto
conf
=
uniset_init
(
argc
,
argv
,
conffile
);
UInterface
ui
(
conf
);
ui
.
initBackId
(
UniSetTypes
::
AdminID
);
return
getRawValue
(
optarg
,
ui
);
string
name
=
(
optarg
)
?
optarg
:
""
;
return
getRawValue
(
name
,
ui
);
}
break
;
...
...
@@ -213,7 +216,8 @@ int main(int argc, char** argv)
auto
conf
=
uniset_init
(
argc
,
argv
,
conffile
);
UInterface
ui
(
conf
);
ui
.
initBackId
(
UniSetTypes
::
AdminID
);
return
getChangedTime
(
optarg
,
ui
);
string
name
=
(
optarg
)
?
optarg
:
""
;
return
getChangedTime
(
name
,
ui
);
}
break
;
...
...
@@ -271,7 +275,8 @@ int main(int argc, char** argv)
auto
conf
=
uniset_init
(
argc
,
argv
,
conffile
);
UInterface
ui
(
conf
);
ui
.
initBackId
(
UniSetTypes
::
AdminID
);
return
configure
(
optarg
,
ui
);
string
name
=
(
optarg
)
?
optarg
:
""
;
return
configure
(
name
,
ui
);
}
break
;
...
...
@@ -299,7 +304,8 @@ int main(int argc, char** argv)
auto
conf
=
uniset_init
(
argc
,
argv
,
conffile
);
UInterface
ui
(
conf
);
ui
.
initBackId
(
UniSetTypes
::
AdminID
);
return
logRotate
(
optarg
,
ui
);
string
name
=
(
optarg
)
?
optarg
:
""
;
return
logRotate
(
name
,
ui
);
}
break
;
...
...
@@ -309,7 +315,8 @@ int main(int argc, char** argv)
auto
conf
=
uniset_init
(
argc
,
argv
,
conffile
);
UInterface
ui
(
conf
);
ui
.
initBackId
(
UniSetTypes
::
AdminID
);
return
getCalibrate
(
optarg
,
ui
);
string
name
=
(
optarg
)
?
optarg
:
""
;
return
getCalibrate
(
name
,
ui
);
}
break
;
...
...
@@ -366,6 +373,11 @@ int main(int argc, char** argv)
cerr
<<
" mesg: "
<<
fe
.
errmsg
()
<<
endl
;
}
}
catch
(
std
::
exception
&
ex
)
{
if
(
!
quiet
)
cerr
<<
"exception: "
<<
ex
.
what
()
<<
endl
;
}
catch
(...)
{
if
(
!
quiet
)
...
...
@@ -891,7 +903,7 @@ int logRotate( const string& arg, UInterface& ui )
auto
conf
=
ui
.
getConf
();
// посылка всем
if
(
arg
.
empty
()
||
(
arg
.
c_str
())[
0
]
!
=
'-'
)
if
(
arg
.
empty
()
||
arg
[
0
]
=
=
'-'
)
{
auto
rep
=
make_shared
<
ObjectRepository
>
(
conf
);
commandToAll
(
conf
->
getServicesSection
(),
rep
,
(
Command
)
LogRotate
);
...
...
@@ -900,12 +912,16 @@ int logRotate( const string& arg, UInterface& ui )
}
else
// посылка определённому объекту
{
UniSetTypes
::
ObjectId
id
=
conf
->
oind
->
getIdByName
(
arg
);
UniSetTypes
::
ObjectId
id
=
conf
->
getObjectID
(
arg
);
if
(
id
==
DefaultObjectId
)
id
=
conf
->
getControllerID
(
arg
);
else
if
(
id
==
DefaultObjectId
)
id
=
conf
->
getServiceID
(
arg
);
if
(
id
==
DefaultObjectId
)
{
if
(
!
quiet
)
cout
<<
"(logrotate): n
ame='"
<<
arg
<<
"' не найдено!!!
\n
"
;
cout
<<
"(logrotate): n
ot found ID for name='"
<<
arg
<<
"'"
<<
endl
;
return
1
;
}
...
...
@@ -927,7 +943,7 @@ int configure( const string& arg, UInterface& ui )
auto
conf
=
ui
.
getConf
();
// посылка всем
if
(
arg
.
empty
()
||
(
arg
.
c_str
())[
0
]
!
=
'-'
)
if
(
arg
.
empty
()
||
arg
[
0
]
=
=
'-'
)
{
auto
rep
=
make_shared
<
ObjectRepository
>
(
conf
);
commandToAll
(
conf
->
getServicesSection
(),
rep
,
(
Command
)
Configure
);
...
...
@@ -936,7 +952,11 @@ int configure( const string& arg, UInterface& ui )
}
else
// посылка определённому объекту
{
UniSetTypes
::
ObjectId
id
=
conf
->
oind
->
getIdByName
(
arg
);
UniSetTypes
::
ObjectId
id
=
conf
->
getObjectID
(
arg
);
if
(
id
==
DefaultObjectId
)
id
=
conf
->
getControllerID
(
arg
);
else
if
(
id
==
DefaultObjectId
)
id
=
conf
->
getServiceID
(
arg
);
if
(
id
==
DefaultObjectId
)
{
...
...
@@ -1031,3 +1051,4 @@ void errDoNotReolve( const std::string& oname )
if
(
verb
)
cerr
<<
oname
<<
": resolve failed.."
<<
endl
;
}
// --------------------------------------------------------------------------------------
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