Skip to content

Commit c2ceca8

Browse files
committed
allow clients to call gufi_query
gufi_query.py is not meant to be called directly by users tests are just the first few gufi_query tests changed GitHub Actions builds to build with CLIENT=On
1 parent 06b8cf3 commit c2ceca8

File tree

14 files changed

+304
-6
lines changed

14 files changed

+304
-6
lines changed

.github/workflows/check.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ env:
6868
CC: clang
6969
CXX: clang++
7070
DEP_INSTALL_PREFIX: ~/.local
71-
COMMON_CONFIG: -DCMAKE_BUILD_TYPE=Debug -DCMAKE_C_FLAGS="-Wall -Wextra -Werror -pedantic" -DCMAKE_CXX_FLAGS="-Wall -Wextra -Werror -pedantic" -DDEP_INSTALL_PREFIX="${DEP_INSTALL_PREFIX}" -DDEP_BUILD_THREADS=2 -DENABLE_SUDO_TESTS=On
71+
COMMON_CONFIG: -DCMAKE_BUILD_TYPE=Debug -DCMAKE_C_FLAGS="-Wall -Wextra -Werror -pedantic" -DCMAKE_CXX_FLAGS="-Wall -Wextra -Werror -pedantic" -DDEP_INSTALL_PREFIX="${DEP_INSTALL_PREFIX}" -DDEP_BUILD_THREADS=2 -DENABLE_SUDO_TESTS=On -DCLIENT=On
7272
PIP_BREAK_SYSTEM_PACKAGES: 1
7373

7474
jobs:

.github/workflows/codecov.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ env:
6868
CC: gcc
6969
CXX: g++
7070
DEP_INSTALL_PREFIX: ~/.local
71-
COMMON_CONFIG: -DCMAKE_C_FLAGS="-Wall -Wextra -Werror -pedantic" -DCMAKE_CXX_FLAGS="-Wall -Wextra -Werror -pedantic -std=c++11" -DDEP_INSTALL_PREFIX="${DEP_INSTALL_PREFIX}" -DDEP_BUILD_THREADS=2 -DENABLE_SUDO_TESTS=On -DGCOV=On -DCMAKE_BUILD_TYPE=Debug
71+
COMMON_CONFIG: -DCMAKE_C_FLAGS="-Wall -Wextra -Werror -pedantic" -DCMAKE_CXX_FLAGS="-Wall -Wextra -Werror -pedantic -std=c++11" -DDEP_INSTALL_PREFIX="${DEP_INSTALL_PREFIX}" -DDEP_BUILD_THREADS=2 -DENABLE_SUDO_TESTS=On -DGCOV=On -DCMAKE_BUILD_TYPE=Debug -DCLIENT=On
7272
PIP_BREAK_SYSTEM_PACKAGES: 1
7373

7474
jobs:

.github/workflows/codeql.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ env:
6868
CC: clang
6969
CXX: clang++
7070
DEP_INSTALL_PREFIX: ~/.local
71-
COMMON_CONFIG: -DCMAKE_C_FLAGS="-Wall -Wextra -Werror -pedantic" -DCMAKE_CXX_FLAGS="-Wall -Wextra -Werror -pedantic" -DDEP_INSTALL_PREFIX="${DEP_INSTALL_PREFIX}" -DDEP_BUILD_THREADS=2 -DENABLE_SUDO_TESTS=On
71+
COMMON_CONFIG: -DCMAKE_C_FLAGS="-Wall -Wextra -Werror -pedantic" -DCMAKE_CXX_FLAGS="-Wall -Wextra -Werror -pedantic" -DDEP_INSTALL_PREFIX="${DEP_INSTALL_PREFIX}" -DDEP_BUILD_THREADS=2 -DENABLE_SUDO_TESTS=On -DCLIENT=On
7272
PIP_BREAK_SYSTEM_PACKAGES: 1
7373

7474
jobs:

.github/workflows/test.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ env:
6868
CC: clang
6969
CXX: clang++
7070
DEP_INSTALL_PREFIX: ~/.local
71-
COMMON_CONFIG: -DCMAKE_C_FLAGS="-Wall -Wextra -Werror -pedantic" -DCMAKE_CXX_FLAGS="-Wall -Wextra -Werror -pedantic" -DDEP_INSTALL_PREFIX="${DEP_INSTALL_PREFIX}" -DDEP_BUILD_THREADS=2 -DENABLE_SUDO_TESTS=On
71+
COMMON_CONFIG: -DCMAKE_C_FLAGS="-Wall -Wextra -Werror -pedantic" -DCMAKE_CXX_FLAGS="-Wall -Wextra -Werror -pedantic" -DDEP_INSTALL_PREFIX="${DEP_INSTALL_PREFIX}" -DDEP_BUILD_THREADS=2 -DENABLE_SUDO_TESTS=On -DCLIENT=On
7272
PIP_BREAK_SYSTEM_PACKAGES: 1
7373

7474
jobs:

docs/latex/gufi_user.tex

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,4 +96,10 @@
9696
\include{sections/gufi_stat}
9797
\include{sections/gufi_stats}
9898

99+
\section{\gufiquery}
100+
\gufiquery is available on the client side. However, as it is intended
101+
for use by advanced users, it will not be described here. Please see
102+
the administrator or developer documentation for details about
103+
\gufiquery.
104+
99105
\end{document}

docs/man/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@
6363
set(SERVER_CLIENT_MAN_PAGES
6464
gufi_find.1
6565
gufi_ls.1
66+
gufi_query.1
6667
gufi_stat.1
6768
gufi_stats.1
6869
)
@@ -71,7 +72,6 @@ set(SERVER_MAN_PAGES
7172
bfwreaddirplus2db.1
7273
gufi_dir2index.1
7374
gufi_dir2trace.1
74-
gufi_query.1
7575
gufi_trace2index.1
7676
gufi_treesummary.1
7777
querydbs.1

scripts/CMakeLists.txt

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,21 @@ foreach(TOOL ${TOOLS})
9494
endif()
9595
endforeach()
9696

97+
# allow for clients to call gufi_query via a script
98+
if (CLIENT)
99+
set(TOOL "query.py")
100+
set(USER_TOOL "gufi_${TOOL}")
101+
configure_file("${USER_TOOL}" "${USER_TOOL}" @ONLY)
102+
install(PROGRAMS "${CMAKE_CURRENT_BINARY_DIR}/${USER_TOOL}" DESTINATION "${BIN}" COMPONENT Server)
103+
104+
set(CLIENT_TOOL "${CMAKE_CURRENT_BINARY_DIR}/gufi_client_query")
105+
configure_file("gufi_client" "${CLIENT_TOOL}" @ONLY)
106+
install(PROGRAMS "${CLIENT_TOOL}"
107+
RENAME "gufi_query"
108+
DESTINATION "${BIN}"
109+
COMPONENT Client) # this is always needed for make package
110+
endif()
111+
97112
# gufi_jail is used by sshd_config to prevent commands other than gufi_* from running
98113
configure_file(gufi_jail gufi_jail @ONLY)
99114
install(PROGRAMS "${CMAKE_CURRENT_BINARY_DIR}/gufi_jail" DESTINATION "${BIN}" COMPONENT Server)

scripts/gufi_jail

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ set -f
1313

1414
set -- ${SSH_ORIGINAL_COMMAND}
1515
case "$1" in
16-
gufi_find|gufi_ls|gufi_stat|gufi_stats)
16+
gufi_find|gufi_ls|gufi_query|gufi_stat|gufi_stats)
1717
;;
1818
*)
1919
echo "Error: Command \"$1\" is not allowed" >&2

scripts/gufi_query.py

Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
1+
#!/usr/bin/env python3
2+
# This file is part of GUFI, which is part of MarFS, which is released
3+
# under the BSD license.
4+
#
5+
#
6+
# Copyright (c) 2017, Los Alamos National Security (LANS), LLC
7+
# All rights reserved.
8+
#
9+
# Redistribution and use in source and binary forms, with or without modification,
10+
# are permitted provided that the following conditions are met:
11+
#
12+
# 1. Redistributions of source code must retain the above copyright notice, this
13+
# list of conditions and the following disclaimer.
14+
#
15+
# 2. Redistributions in binary form must reproduce the above copyright notice,
16+
# this list of conditions and the following disclaimer in the documentation and/or
17+
# other materials provided with the distribution.
18+
#
19+
# 3. Neither the name of the copyright holder nor the names of its contributors
20+
# may be used to endorse or promote products derived from this software without
21+
# specific prior written permission.
22+
#
23+
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
24+
# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
25+
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
26+
# IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
27+
# INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
28+
# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
29+
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
30+
# LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
31+
# OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
32+
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
33+
#
34+
#
35+
# From Los Alamos National Security, LLC:
36+
# LA-CC-15-039
37+
#
38+
# Copyright (c) 2017, Los Alamos National Security, LLC All rights reserved.
39+
# Copyright 2017. Los Alamos National Security, LLC. This software was produced
40+
# under U.S. Government contract DE-AC52-06NA25396 for Los Alamos National
41+
# Laboratory (LANL), which is operated by Los Alamos National Security, LLC for
42+
# the U.S. Department of Energy. The U.S. Government has rights to use,
43+
# reproduce, and distribute this software. NEITHER THE GOVERNMENT NOR LOS
44+
# ALAMOS NATIONAL SECURITY, LLC MAKES ANY WARRANTY, EXPRESS OR IMPLIED, OR
45+
# ASSUMES ANY LIABILITY FOR THE USE OF THIS SOFTWARE. If software is
46+
# modified to produce derivative works, such modified software should be
47+
# clearly marked, so as not to confuse it with the version available from
48+
# LANL.
49+
#
50+
# THIS SOFTWARE IS PROVIDED BY LOS ALAMOS NATIONAL SECURITY, LLC AND CONTRIBUTORS
51+
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
52+
# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
53+
# ARE DISCLAIMED. IN NO EVENT SHALL LOS ALAMOS NATIONAL SECURITY, LLC OR
54+
# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
55+
# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
56+
# OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
57+
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
58+
# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
59+
# IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
60+
# OF SUCH DAMAGE.
61+
62+
63+
64+
# This file should generally not be called directly. This script is
65+
# meant for advanced users running on clients to call gufi_query
66+
# without knowing the indexroot.
67+
import subprocess
68+
import sys
69+
70+
import gufi_config # pylint: disable=wrong-import-position
71+
72+
def run(args, config_path):
73+
'''
74+
Send all arguments to gufi_query
75+
'''
76+
77+
config = gufi_config.Server(config_path)
78+
79+
cmd = [config.query] + args[1:] + [config.indexroot]
80+
81+
# run the command
82+
query = subprocess.Popen(cmd) # pylint: disable=consider-using-with
83+
query.communicate() # block until query finishes
84+
85+
return query.returncode
86+
87+
if __name__ == '__main__':
88+
sys.exit(run(sys.argv, gufi_config.PATH))

test/regression/CMakeLists.txt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,12 @@ set(PYTHON
9797
gufi_stats
9898
)
9999

100+
if (CLIENT)
101+
list(APPEND PYTHON
102+
gufi_query.py
103+
)
104+
endif()
105+
100106
set(EXAMPLES
101107
deluidgidsummaryrecs
102108
generategidsummary

0 commit comments

Comments
 (0)