Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Robert Verkerk
B2SAFE Core
Commits
f85fd5e4
Unverified
Commit
f85fd5e4
authored
Nov 23, 2018
by
ccacciari
Committed by
GitHub
Nov 23, 2018
Browse files
Merge pull request #121 from cookie33/devel
Bugfix. Prevent adding same handle in EUDAT/REPLICA
parents
f29889ef
1cc01793
Changes
3
Hide whitespace changes
Inline
Side-by-side
cmd/regex_search_string.py
0 → 100755
View file @
f85fd5e4
#!/usr/bin/env python
import
re
import
sys
def
search_pattern_in_string
(
pattern
,
string
):
"""
search_pattern_in_string. Search if a pattern matches in a string.
return match in string if found.
return "no match found!" if not found
"""
searchObj
=
re
.
search
(
pattern
,
string
,
re
.
U
|
re
.
I
)
if
searchObj
:
print
searchObj
.
group
()
else
:
print
"no match found!"
if
__name__
==
"__main__"
:
search_pattern_in_string
(
sys
.
argv
[
1
],
sys
.
argv
[
2
])
rulebase/pid-service.re
View file @
f85fd5e4
...
...
@@ -195,7 +195,9 @@ EUDATUpdatePIDWithNewChild(*parentPID, *childPID) {
*
replicaNew
=
*
childPID
;
}
else
{
if
(
*
replica
like
"*"
++*
childPID
++
"*"
)
{
msiExecCmd
(
"regex_search_string.py"
,
"*childPID *replica"
,
"null"
,
"null"
,
"null"
,
*
status
);
msiGetStdoutInExecCmdOut
(
*
status
,
*
response
);
if
(
*
response
not
like
"no match found!"
)
{
*
replicaNew
=
*
replica
;
}
else
{
...
...
scripts/tests/testB2SafeCmd/epic2intgtest.py
View file @
f85fd5e4
...
...
@@ -106,7 +106,7 @@ class EpicClient2IntegrationTests(unittest.TestCase):
search_result
=
subprocess_popen
(
command
)
search_result_json
=
json
.
loads
(
search_result
[
0
])
self
.
assertEqual
(
create_result
[
0
],
search_result_json
[
0
],
unicode
(
create_result
[
0
]
).
lower
()
,
search_result_json
[
0
]
.
lower
()
,
'search existing handle by key returns unexpected response'
)
...
...
@@ -168,7 +168,7 @@ class EpicClient2IntegrationTests(unittest.TestCase):
command
=
[
EPIC_PATH
,
CRED_STORE
,
CRED_PATH
,
'search'
,
'URL'
,
'http://www.testB2SafeCmd.com/1'
]
search_result
=
subprocess_popen
(
command
)
search_result_json
=
json
.
loads
(
search_result
[
0
])
self
.
assertEqual
(
create_result
[
0
],
search_result_json
[
0
],
self
.
assertEqual
(
unicode
(
create_result
[
0
]
).
lower
()
,
search_result_json
[
0
]
.
lower
()
,
'create handle should add new handle'
)
...
...
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