k2hr3-api 1.0.37 → 1.0.39

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (65) hide show
  1. package/ChangeLog +12 -0
  2. package/README.md +31 -31
  3. package/app.js +6 -10
  4. package/bin/run.sh +21 -21
  5. package/bin/www +1 -1
  6. package/config/k2hr3-init.sh.templ +5 -5
  7. package/eslint.config.mjs +68 -0
  8. package/lib/cacerts.js +8 -7
  9. package/lib/dummyuserapi.js +1 -1
  10. package/lib/ipwatch.js +1 -1
  11. package/lib/k2hr3acrutil.js +12 -14
  12. package/lib/k2hr3apiutil.js +5 -5
  13. package/lib/k2hr3cryptutil.js +2 -0
  14. package/lib/k2hr3dkc.js +25 -28
  15. package/lib/k2hr3template.js +54 -52
  16. package/lib/k2hr3tokens.js +4 -4
  17. package/lib/k8soidc.js +3 -3
  18. package/lib/openstackapiv2.js +51 -52
  19. package/lib/openstackapiv3.js +86 -87
  20. package/lib/openstackep.js +46 -46
  21. package/package.json +8 -8
  22. package/routes/acr.js +66 -110
  23. package/routes/debugVerify.js +12 -14
  24. package/routes/extdata.js +24 -40
  25. package/routes/list.js +24 -36
  26. package/routes/policy.js +72 -120
  27. package/routes/resource.js +110 -165
  28. package/routes/role.js +177 -295
  29. package/routes/service.js +54 -90
  30. package/routes/userTokens.js +1 -1
  31. package/routes/userdata.js +12 -20
  32. package/routes/version.js +39 -23
  33. package/tests/auto_control_subprocess.sh +9 -9
  34. package/tests/auto_init_config_json.sh +3 -3
  35. package/tests/auto_resource.js +417 -478
  36. package/tests/auto_role.js +55 -71
  37. package/tests/auto_template.sh +4 -4
  38. package/tests/auto_version.js +39 -23
  39. package/tests/k2hdkc_test_load.sh +9 -9
  40. package/tests/k2hr3template_test.sh +12 -12
  41. package/tests/k2hr3template_test_vars.js +60 -62
  42. package/tests/manual_acr_delete.js +11 -12
  43. package/tests/manual_acr_get.js +9 -10
  44. package/tests/manual_acr_postput.js +12 -13
  45. package/tests/manual_extdata_get.js +5 -6
  46. package/tests/manual_list_gethead.js +12 -13
  47. package/tests/manual_policy_delete.js +12 -13
  48. package/tests/manual_policy_gethead.js +27 -27
  49. package/tests/manual_policy_postput.js +21 -23
  50. package/tests/manual_resource_delete.js +11 -15
  51. package/tests/manual_resource_gethead.js +11 -14
  52. package/tests/manual_resource_postput.js +18 -21
  53. package/tests/manual_role_delete.js +22 -28
  54. package/tests/manual_role_gethead.js +53 -53
  55. package/tests/manual_role_postput.js +28 -31
  56. package/tests/manual_service_delete.js +11 -13
  57. package/tests/manual_service_gethead.js +13 -15
  58. package/tests/manual_service_postput.js +10 -11
  59. package/tests/manual_test.sh +10 -10
  60. package/tests/manual_userdata_get.js +14 -15
  61. package/tests/manual_usertoken_gethead.js +12 -14
  62. package/tests/manual_usertoken_postput.js +23 -26
  63. package/tests/manual_version_get.js +12 -13
  64. package/tests/run_local_test_k2hdkc.sh +4 -4
  65. package/tests/test.sh +12 -12
@@ -42,19 +42,18 @@ var is_https = apiutil.compareCaseString('yes', process.env.HTTPS_ENV);
42
42
  //
43
43
  function getV1Version(is_top)
44
44
  {
45
- /* eslint-disable indent, no-mixed-spaces-and-tabs */
46
- var ver_path = is_top ? '/' : '/v1';
47
- var headers = {
48
- 'Content-Type': 'application/json',
49
- 'Content-Length': 0
50
- };
51
- var options = { 'host': hostname,
52
- 'port': hostport,
53
- 'path': ver_path,
54
- 'method': 'GET',
55
- 'headers': headers
56
- };
57
- /* eslint-enable indent, no-mixed-spaces-and-tabs */
45
+ var ver_path = is_top ? '/' : '/v1';
46
+ var headers = {
47
+ 'Content-Type': 'application/json',
48
+ 'Content-Length': 0
49
+ };
50
+ var options = {
51
+ 'host': hostname,
52
+ 'port': hostport,
53
+ 'path': ver_path,
54
+ 'method': 'GET',
55
+ 'headers': headers
56
+ };
58
57
 
59
58
  r3logger.dlog('request options = ' + JSON.stringify(options));
60
59
  r3logger.dlog('request headers = ' + JSON.stringify(headers));
@@ -56,11 +56,11 @@ while [ $# -ne 0 ]; do
56
56
  if [ -z "$1" ]; then
57
57
  break
58
58
 
59
- elif [ "$1" = "-h" ] || [ "$1" = "-H" ] || [ "$1" = "--help" ] || [ "$1" = "--HELP" ]; then
59
+ elif echo "$1" | grep -q -i -e "^-h$" -e "^--help$"; then
60
60
  PrintUsage "${PRGNAME}"
61
61
  exit 0
62
62
 
63
- elif [ "$1" = "-k" ] || [ "$1" = "-K" ] || [ "$1" = "--key" ] || [ "$1" = "--KEY" ]; then
63
+ elif echo "$1" | grep -q -i -e "^-k$" -e "^--key$"; then
64
64
  if [ -n "${KEY_SUFFIX}" ]; then
65
65
  echo "[ERROR] already set --key(-k) option"
66
66
  exit 1
@@ -72,14 +72,14 @@ while [ $# -ne 0 ]; do
72
72
  fi
73
73
  KEY_SUFFIX="_$1"
74
74
 
75
- elif [ "$1" = "start" ] || [ "$1" = "START" ]; then
75
+ elif echo "$1" | grep -q -i "^start$"; then
76
76
  if [ -n "${SCRIPT_MODE}" ]; then
77
77
  echo "[ERROR] already specified start or stop"
78
78
  exit 1
79
79
  fi
80
80
  SCRIPT_MODE="start"
81
81
 
82
- elif [ "$1" = "stop" ] || [ "$1" = "STOP" ]; then
82
+ elif echo "$1" | grep -q -i "^stop$"; then
83
83
  if [ -n "${SCRIPT_MODE}" ]; then
84
84
  echo "[ERROR] already specified start or stop"
85
85
  exit 1
package/tests/test.sh CHANGED
@@ -122,32 +122,32 @@ while [ $# -ne 0 ]; do
122
122
  if [ -z "$1" ]; then
123
123
  break
124
124
 
125
- elif [ "$1" = "-h" ] || [ "$1" = "-H" ] || [ "$1" = "--help" ] || [ "$1" = "--HELP" ]; then
125
+ elif echo "$1" | grep -q -i -e "^-h$" -e "^--help$"; then
126
126
  PrintUsage "${PRGNAME}"
127
127
  exit 0
128
128
 
129
- elif [ "$1" = "-prod" ] || [ "$1" = "-PROD" ] || [ "$1" = "--production" ] || [ "$1" = "--PRODUCTION" ]; then
129
+ elif echo "$1" | grep -q -i -e "^-prod$" -e "^--production$"; then
130
130
  if [ -n "${NODE_ENV_VALUE}" ]; then
131
131
  echo "[ERROR] already specified --production(-prod) or --development(-dev) option"
132
132
  exit 1
133
133
  fi
134
134
  NODE_ENV_VALUE="production"
135
135
 
136
- elif [ "$1" = "-dev" ] || [ "$1" = "-DEV" ] || [ "$1" = "--development" ] || [ "$1" = "--DEVELOPMENT" ]; then
136
+ elif echo "$1" | grep -q -i -e "^-dev$" -e "^--development$"; then
137
137
  if [ "${NODE_ENV_VALUE}" != "" ]; then
138
138
  echo "[ERROR] already specified --production(-prod) or --development(-dev) option"
139
139
  exit 1
140
140
  fi
141
141
  NODE_ENV_VALUE="development"
142
142
 
143
- elif [ "$1" = "-l" ] || [ "$1" = "-L" ] || [ "$1" = "--logger" ] || [ "$1" = "--LOGGER" ]; then
143
+ elif echo "$1" | grep -q -i -e "^-l$" -e "^--logger$"; then
144
144
  if [ "${IS_LOGGING}" -eq 1 ]; then
145
145
  echo "[ERROR] Already --logger(-l) option is set"
146
146
  exit 1
147
147
  fi
148
148
  IS_LOGGING=1
149
149
 
150
- elif [ "$1" = "-d" ] || [ "$1" = "-D" ] || [ "$1" = "--debuglevel" ] || [ "$1" = "--DEBUGLEVEL" ]; then
150
+ elif echo "$1" | grep -q -i -e "^-d$" -e "^--debuglevel$"; then
151
151
  #
152
152
  # DEBUG option
153
153
  #
@@ -156,25 +156,25 @@ while [ $# -ne 0 ]; do
156
156
  echo "[ERROR] --debuglevel(-d) option needs parameter(dbg/msg/warn/err/custom debug level)"
157
157
  exit 1
158
158
  fi
159
- if [ "$1" = "dbg" ] || [ "$1" = "DBG" ] || [ "$1" = "debug" ] || [ "$1" = "DEBUG" ]; then
159
+ if echo "$1" | grep -q -i -e "^dbg$" -e "^debug$"; then
160
160
  if [ "${DEBUG_ENV_LEVEL}" -ne 0 ]; then
161
161
  echo "[ERROR] --debuglevel(-d) option already is set"
162
162
  exit 1
163
163
  fi
164
164
  DEBUG_ENV_LEVEL=4
165
- elif [ "$1" = "msg" ] || [ "$1" = "MSG" ] || [ "$1" = "message" ] || [ "$1" = "MESSAGE" ] || [ "$1" = "info" ] || [ "$1" = "INFO" ]; then
165
+ elif echo "$1" | grep -q -i -e "^msg$" -e "^message$" -e "^info$"; then
166
166
  if [ "${DEBUG_ENV_LEVEL}" -ne 0 ]; then
167
167
  echo "[ERROR] --debuglevel(-d) option already is set"
168
168
  exit 1
169
169
  fi
170
170
  DEBUG_ENV_LEVEL=3
171
- elif [ "$1" = "warn" ] || [ "$1" = "WARN" ] || [ "$1" = "warning" ] || [ "$1" = "WARNING" ]; then
171
+ elif echo "$1" | grep -q -i -e "^wan$" -e "^warn$" -e "^warning$"; then
172
172
  if [ "${DEBUG_ENV_LEVEL}" -ne 0 ]; then
173
173
  echo "[ERROR] --debuglevel(-d) option already is set"
174
174
  exit 1
175
175
  fi
176
176
  DEBUG_ENV_LEVEL=2
177
- elif [ "$1" = "err" ] || [ "$1" = "ERR" ] || [ "$1" = "error" ] || [ "$1" = "ERROR" ]; then
177
+ elif echo "$1" | grep -q -i -e "^err$" -e "^error$"; then
178
178
  if [ "${DEBUG_ENV_LEVEL}" -ne 0 ]; then
179
179
  echo "[ERROR] --debuglevel(-d) option already is set"
180
180
  exit 1
@@ -190,7 +190,7 @@ while [ $# -ne 0 ]; do
190
190
  DEBUG_ENV_CUSTOM="${DEBUG_ENV_CUSTOM}$1"
191
191
  fi
192
192
 
193
- elif [ "$1" = "-t" ] || [ "$1" = "-T" ] || [ "$1" = "--timeout" ] || [ "$1" = "--TIMEOUT" ]; then
193
+ elif echo "$1" | grep -q -i -e "^-t$" -e "^--timeout$"; then
194
194
  #
195
195
  # timeout option
196
196
  #
@@ -281,9 +281,9 @@ else
281
281
  # Nothing to do for default
282
282
  #
283
283
  :
284
- elif [ "${NODE_LOGGER}" = "yes" ] || [ "${NODE_LOGGER}" = "YES" ]; then
284
+ elif echo "${NODE_LOGGER}" | grep -q -i -e "^y$" -e "^yes$"; then
285
285
  NODE_LOGGER=""
286
- elif [ "${NODE_LOGGER}" = "no" ] || [ "${NODE_LOGGER}" = "NO" ]; then
286
+ elif echo "${NODE_LOGGER}" | grep -q -i -e "^n$" -e "^no$"; then
287
287
  NODE_LOGGER="no"
288
288
  else
289
289
  echo "[WARNING] NODE_LOGGER environment has wrong value(${NODE_LOGGER}), then do logging(default)"