Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
cta
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
Harbor 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
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
dCache
cta
Commits
48904a70
Commit
48904a70
authored
8 years ago
by
Steven Murray
Browse files
Options
Downloads
Patches
Plain Diff
WriteNotificationMsgCmd now fills the notification message with better info
parent
58eb3b5d
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
xroot_plugins/WriteNotificationMsgCmd.cpp
+20
-3
20 additions, 3 deletions
xroot_plugins/WriteNotificationMsgCmd.cpp
xroot_plugins/WriteNotificationMsgCmd.hpp
+5
-0
5 additions, 0 deletions
xroot_plugins/WriteNotificationMsgCmd.hpp
with
25 additions
and
3 deletions
xroot_plugins/WriteNotificationMsgCmd.cpp
+
20
−
3
View file @
48904a70
...
...
@@ -16,6 +16,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include
"common/exception/Exception.hpp"
#include
"common/make_unique.hpp"
#include
"eos/messages/eos_messages.pb.h"
#include
"xroot_plugins/WriteNotificationMsgCmd.hpp"
...
...
@@ -25,6 +26,7 @@
#include
<iostream>
#include
<stdint.h>
#include
<string>
#include
<unistd.h>
#include
<google/protobuf/util/json_util.h>
...
...
@@ -61,12 +63,12 @@ int WriteNotificationMsgCmd::exceptionThrowingMain(const int argc, char *const *
wrapper
.
mutable_notification
()
->
mutable_wf
()
->
set_queue
(
"notification_workflow_queue"
);
wrapper
.
mutable_notification
()
->
mutable_wf
()
->
set_wfname
(
"default"
);
wrapper
.
mutable_notification
()
->
mutable_wf
()
->
set_vpath
(
"notification_workflow_vpath"
);
wrapper
.
mutable_notification
()
->
mutable_wf
()
->
mutable_instance
()
->
set_name
(
"
notification_instance_name
"
);
wrapper
.
mutable_notification
()
->
mutable_wf
()
->
mutable_instance
()
->
set_name
(
"
eosdev
"
);
wrapper
.
mutable_notification
()
->
mutable_wf
()
->
mutable_instance
()
->
set_url
(
"notification_instance_url"
);
wrapper
.
mutable_notification
()
->
mutable_wf
()
->
set_timestamp
(
1100
);
wrapper
.
mutable_notification
()
->
set_turl
(
"notification_turl"
);
wrapper
.
mutable_notification
()
->
mutable_cli
()
->
mutable_user
()
->
set_uid
(
1111
);
wrapper
.
mutable_notification
()
->
mutable_cli
()
->
mutable_user
()
->
set_username
(
"notification_cli_user_u
sername
"
);
wrapper
.
mutable_notification
()
->
mutable_cli
()
->
mutable_user
()
->
set_username
(
getU
sername
()
);
wrapper
.
mutable_notification
()
->
mutable_cli
()
->
mutable_user
()
->
set_gid
(
1122
);
wrapper
.
mutable_notification
()
->
mutable_cli
()
->
mutable_user
()
->
set_groupname
(
"notification_cli_user_groupname"
);
wrapper
.
mutable_notification
()
->
mutable_cli
()
->
mutable_sec
()
->
set_host
(
"notification_cli_sec_host"
);
...
...
@@ -116,7 +118,7 @@ int WriteNotificationMsgCmd::exceptionThrowingMain(const int argc, char *const *
wrapper
.
mutable_notification
()
->
mutable_directory
()
->
set_lpath
(
"notification_directory_lpath"
);
(
*
wrapper
.
mutable_notification
()
->
mutable_directory
()
->
mutable_xattr
())[
"notification_directory_attr1"
]
=
"directory_xattr1_value"
;
(
*
wrapper
.
mutable_notification
()
->
mutable_directory
()
->
mutable_xattr
())[
"notification_directory_attr2"
]
=
"directory_xattr2_value"
;
(
*
wrapper
.
mutable_notification
()
->
mutable_directory
()
->
mutable_xattr
())[
"CTA_StorageClass"
]
=
"
CTA_StorageClass
"
;
(
*
wrapper
.
mutable_notification
()
->
mutable_directory
()
->
mutable_xattr
())[
"CTA_StorageClass"
]
=
"
single
"
;
if
(
cmdLineArgs
.
writeJsonToStdOut
)
{
google
::
protobuf
::
util
::
JsonPrintOptions
options
;
...
...
@@ -139,6 +141,21 @@ int WriteNotificationMsgCmd::exceptionThrowingMain(const int argc, char *const *
return
0
;
}
//------------------------------------------------------------------------------
// getUsername
//------------------------------------------------------------------------------
std
::
string
WriteNotificationMsgCmd
::
getUsername
()
{
char
buf
[
128
];
if
(
0
!=
getlogin_r
(
buf
,
sizeof
(
buf
)))
{
throw
cta
::
exception
::
Exception
(
std
::
string
(
__FUNCTION__
)
+
" failed: getlogin_r() failed"
);
}
buf
[
sizeof
(
buf
)
-
1
]
=
'\0'
;
return
buf
;
}
//------------------------------------------------------------------------------
// printUsage
//------------------------------------------------------------------------------
...
...
This diff is collapsed.
Click to expand it.
xroot_plugins/WriteNotificationMsgCmd.hpp
+
5
−
0
View file @
48904a70
...
...
@@ -55,6 +55,11 @@ private:
*/
int
exceptionThrowingMain
(
const
int
argc
,
char
*
const
*
const
argv
)
override
;
/**
* Returns the name of the current UNIX user.
*/
static
std
::
string
getUsername
();
/**
* Prints the usage message of the command-line tool.
*
...
...
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