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
ea34d077
Commit
ea34d077
authored
2 years ago
by
Miguel Barros
Browse files
Options
Downloads
Patches
Plain Diff
make cta-verify-file get options from config (#1241)
parent
d36e2183
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
ReleaseNotes.md
+1
-1
1 addition, 1 deletion
ReleaseNotes.md
cmdline/CtaVerifyFile.cpp
+46
-31
46 additions, 31 deletions
cmdline/CtaVerifyFile.cpp
continuousintegration/docker/ctafrontend/cc7/opt/run/bin/ctacli.sh
+3
-0
3 additions, 0 deletions
...sintegration/docker/ctafrontend/cc7/opt/run/bin/ctacli.sh
with
50 additions
and
32 deletions
ReleaseNotes.md
+
1
−
1
View file @
ea34d077
...
...
@@ -7,7 +7,7 @@ This release introduced an additional gRPC based frontend for storage backends.
### Upgrade Instructions
### Features
-
cta/CTA#1222 - Add minimal gRPC based frOntend for integration with dCache
-
cta/CTA#1241 - make cta-verify-file get instance, request user and group otions from ctacli config file
### Bug fixes
-
cta/CTA#1225 - Fix bug causing tapeserver to sometimes pop the entire archive queue at the end of the mount
### Building and Packaging
...
...
This diff is collapsed.
Click to expand it.
cmdline/CtaVerifyFile.cpp
+
46
−
31
View file @
ea34d077
...
...
@@ -45,13 +45,13 @@ typedef std::map<std::string, std::string> AttrMap;
// Usage exception
const
std
::
runtime_error
Usage
(
"Usage: cta-verify-file <archiveFileID> [-v <vid>] "
"-i <instance>
-r.user <user>
-r.group <group>
\n
"
"
[
-i <instance>
] [
-r.user <user>
] [
-r.group <group>
]
\n
"
"cta-verify-file <archiveFileID> [--vid <id>] "
"--instance <instance>
--request.user <user>
--request.group <group>"
);
"
[
--instance <instance>
] [
--request.user <user>
] [
--request.group <group>
]
"
);
StringOption
option_instance
{
"--instance"
,
"-i"
,
fals
e
};
StringOption
option_request_user
{
"--request.user"
,
"-r.user"
,
fals
e
};
StringOption
option_request_group
{
"--request.group"
,
"-r.group"
,
fals
e
};
StringOption
option_instance
{
"--instance"
,
"-i"
,
tru
e
};
StringOption
option_request_user
{
"--request.user"
,
"-r.user"
,
tru
e
};
StringOption
option_request_group
{
"--request.group"
,
"-r.group"
,
tru
e
};
StringOption
option_vid
{
"--vid"
,
"-v"
,
true
};
std
::
vector
<
StringOption
*>
verify_options
=
{
&
option_instance
,
&
option_request_user
,
&
option_request_group
,
&
option_vid
};
...
...
@@ -98,38 +98,53 @@ void parse_cmd(const int argc, const char *const *const argv) {
* @param[in] argv Command line arguments array
*/
void
fillNotification
(
cta
::
eos
::
Notification
&
notification
,
const
int
argc
,
const
char
*
const
*
const
argv
)
{
parse_cmd
(
argc
,
argv
);
validate_cmd
();
std
::
string
archiveFileId
(
argv
[
1
]);
{
XrdSsiPb
::
Config
config
(
config_file
,
"eos"
);
for
(
const
auto
&
conf_option
:
std
::
vector
<
std
::
string
>
({
"instance"
,
"requester.user"
,
"requester.group"
}))
{
if
(
!
config
.
getOptionValueStr
(
conf_option
).
first
)
{
throw
std
::
runtime_error
(
conf_option
+
" must be specified in "
+
config_file
);
}
}
notification
.
mutable_wf
()
->
mutable_instance
()
->
set_name
(
config
.
getOptionValueStr
(
"instance"
).
second
);
notification
.
mutable_cli
()
->
mutable_user
()
->
set_username
(
config
.
getOptionValueStr
(
"requester.user"
).
second
);
notification
.
mutable_cli
()
->
mutable_user
()
->
set_groupname
(
config
.
getOptionValueStr
(
"requester.group"
).
second
);
// WF
notification
.
mutable_wf
()
->
set_event
(
cta
::
eos
::
Workflow
::
PREPARE
);
parse_cmd
(
argc
,
argv
);
validate_cmd
(
);
if
(
option_instance
.
is_present
())
{
notification
.
mutable_wf
()
->
mutable_instance
()
->
set_name
(
option_instance
.
get_value
());
notification
.
mutable_wf
()
->
set_requester_instance
(
"cta-verify-file"
);
notification
.
mutable_wf
()
->
set_verify_only
(
true
);
notification
.
mutable_wf
()
->
set_vid
(
option_vid
.
get_value
());
// CLI
notification
.
mutable_cli
()
->
mutable_user
()
->
set_username
(
option_request_user
.
get_value
());
}
if
(
option_request_user
.
is_present
())
{
notification
.
mutable_cli
()
->
mutable_user
()
->
set_username
(
option_request_user
.
get_value
());
}
if
(
option_request_group
.
is_present
())
{
notification
.
mutable_cli
()
->
mutable_user
()
->
set_groupname
(
option_request_group
.
get_value
());
}
// Transport
notification
.
mutable_transport
()
->
set_dst_url
(
"file://dummy"
);
std
::
string
archiveFileId
(
argv
[
1
]);
// File
notification
.
mutable_file
()
->
set_lpath
(
"dummy"
);
// WF
notification
.
mutable_wf
()
->
set_event
(
cta
::
eos
::
Workflow
::
PREPARE
);
notification
.
mutable_wf
()
->
set_requester_instance
(
"cta-verify-file"
);
notification
.
mutable_wf
()
->
set_verify_only
(
true
);
notification
.
mutable_wf
()
->
set_vid
(
option_vid
.
get_value
());
// eXtended attributes
AttrMap
xattrs
;
xattrs
[
"sys.archive.file_id"
]
=
archiveFileId
;
// Transport
notification
.
mutable_transport
()
->
set_dst_url
(
"file://dummy"
)
;
for
(
auto
&
xattr
:
xattrs
)
{
google
::
protobuf
::
MapPair
<
std
::
string
,
std
::
string
>
mp
(
xattr
.
first
,
xattr
.
second
);
notification
.
mutable_file
()
->
mutable_xattr
()
->
insert
(
mp
);
}
// File
notification
.
mutable_file
()
->
set_lpath
(
"dummy"
);
// eXtended attributes
AttrMap
xattrs
;
xattrs
[
"sys.archive.file_id"
]
=
archiveFileId
;
for
(
auto
&
xattr
:
xattrs
)
{
google
::
protobuf
::
MapPair
<
std
::
string
,
std
::
string
>
mp
(
xattr
.
first
,
xattr
.
second
);
notification
.
mutable_file
()
->
mutable_xattr
()
->
insert
(
mp
);
}
}
...
...
@@ -140,7 +155,7 @@ int exceptionThrowingMain(int argc, const char *const *const argv)
{
std
::
string
vid
;
if
(
argc
<
6
||
argc
%
2
)
{
// Since all options need values associated, argc should always be even
if
(
argc
==
1
||
argc
%
2
)
{
// Since all options need values associated, argc should always be even
throw
Usage
;
}
...
...
@@ -162,7 +177,7 @@ int exceptionThrowingMain(int argc, const char *const *const argv)
config
.
getEnv
(
"request_timeout"
,
"XRD_REQUESTTIMEOUT"
);
// If XRDDEBUG=1, switch on all logging
if
(
getenv
(
"XRDDEBUG"
))
{
if
(
getenv
(
"XRDDEBUG"
))
{
config
.
set
(
"log"
,
"all"
);
}
// If fine-grained control over log level is required, use XrdSsiPbLogLevel
...
...
This diff is collapsed.
Click to expand it.
continuousintegration/docker/ctafrontend/cc7/opt/run/bin/ctacli.sh
+
3
−
0
View file @
ea34d077
...
...
@@ -29,6 +29,9 @@ cat <<EOF > /etc/cta/cta-cli.conf
# The CTA frontend address in the form <FQDN>:<TCPPort>
# solved by kubernetes DNS server so KIS...
cta.endpoint ctafrontend:10955
eos.instance ctaeos
eos.requester.user adm
eos.requester.group powerusers
EOF
# sleep forever but exit immediately when pod is deleted
...
...
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