k2hr3-api 1.0.38 → 1.0.40

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,12 +42,10 @@ var is_https = apiutil.compareCaseString('yes', process.env.HTTPS_ENV);
42
42
  //
43
43
  function deleteV1Role(token, name, target_host, port, cuk)
44
44
  {
45
- /* eslint-disable indent, no-mixed-spaces-and-tabs */
46
- var headers = {
47
- 'Content-Type': 'application/json',
48
- 'Content-Length': 0,
49
- };
50
- /* eslint-enable indent, no-mixed-spaces-and-tabs */
45
+ var headers = {
46
+ 'Content-Type': 'application/json',
47
+ 'Content-Length': 0,
48
+ };
51
49
 
52
50
  if(apiutil.isSafeString(token)){
53
51
  headers['X-Auth-Token'] = token;
@@ -69,14 +67,13 @@ function deleteV1Role(token, name, target_host, port, cuk)
69
67
  already_set = true;
70
68
  }
71
69
 
72
- /* eslint-disable indent, no-mixed-spaces-and-tabs */
73
- var options = { 'host': hostname,
74
- 'port': hostport,
75
- 'path': '/v1/role/' + name + encodeURI(urlarg),
76
- 'method': 'DELETE',
77
- 'headers': headers
78
- };
79
- /* eslint-enable indent, no-mixed-spaces-and-tabs */
70
+ var options = {
71
+ 'host': hostname,
72
+ 'port': hostport,
73
+ 'path': '/v1/role/' + name + encodeURI(urlarg),
74
+ 'method': 'DELETE',
75
+ 'headers': headers
76
+ };
80
77
 
81
78
  r3logger.dlog('request options = ' + JSON.stringify(options));
82
79
  r3logger.dlog('request headers = ' + JSON.stringify(headers));
@@ -128,12 +125,10 @@ function deleteV1Role(token, name, target_host, port, cuk)
128
125
  //
129
126
  function deleteV1_IPByCuk(addrs, port, cuk)
130
127
  {
131
- /* eslint-disable indent, no-mixed-spaces-and-tabs */
132
- var headers = {
133
- 'Content-Type': 'application/json',
134
- 'Content-Length': 0,
135
- };
136
- /* eslint-enable indent, no-mixed-spaces-and-tabs */
128
+ var headers = {
129
+ 'Content-Type': 'application/json',
130
+ 'Content-Length': 0,
131
+ };
137
132
 
138
133
  var urlarg = '';
139
134
  var already_set = false;
@@ -157,14 +152,13 @@ function deleteV1_IPByCuk(addrs, port, cuk)
157
152
  already_set = true;
158
153
  }
159
154
 
160
- /* eslint-disable indent, no-mixed-spaces-and-tabs */
161
- var options = { 'host': hostname,
162
- 'port': hostport,
163
- 'path': '/v1/role' + encodeURI(urlarg),
164
- 'method': 'DELETE',
165
- 'headers': headers
166
- };
167
- /* eslint-enable indent, no-mixed-spaces-and-tabs */
155
+ var options = {
156
+ 'host': hostname,
157
+ 'port': hostport,
158
+ 'path': '/v1/role' + encodeURI(urlarg),
159
+ 'method': 'DELETE',
160
+ 'headers': headers
161
+ };
168
162
 
169
163
  r3logger.dlog('request options = ' + JSON.stringify(options));
170
164
  r3logger.dlog('request headers = ' + JSON.stringify(headers));
@@ -42,19 +42,18 @@ var is_https = apiutil.compareCaseString('yes', process.env.HTTPS_ENV);
42
42
  //
43
43
  function getV1Role(token, name, is_expand)
44
44
  {
45
- /* eslint-disable indent, no-mixed-spaces-and-tabs */
46
- var headers = {
47
- 'Content-Type': 'application/json',
48
- 'Content-Length': 0,
49
- 'X-Auth-Token': token
50
- };
51
- var options = { 'host': hostname,
52
- 'port': hostport,
53
- 'path': '/v1/role/' + name + (is_expand ? '' : '?expand=false'), // default expand is true
54
- 'method': 'GET',
55
- 'headers': headers
56
- };
57
- /* eslint-enable indent, no-mixed-spaces-and-tabs */
45
+ var headers = {
46
+ 'Content-Type': 'application/json',
47
+ 'Content-Length': 0,
48
+ 'X-Auth-Token': token
49
+ };
50
+ var options = {
51
+ 'host': hostname,
52
+ 'port': hostport,
53
+ 'path': '/v1/role/' + name + (is_expand ? '' : '?expand=false'), // default expand is true
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));
@@ -103,25 +102,26 @@ function getV1Role(token, name, is_expand)
103
102
 
104
103
  function getV1RoleToken(token, name, expire)
105
104
  {
106
- /* eslint-disable indent, no-mixed-spaces-and-tabs */
107
- var headers = {
108
- 'Content-Type': 'application/json',
109
- 'Content-Length': 0,
110
- };
105
+ var headers = {
106
+ 'Content-Type': 'application/json',
107
+ 'Content-Length': 0,
108
+ };
111
109
  if(apiutil.isSafeString(token)){
112
110
  headers['X-Auth-Token'] = token;
113
111
  }
114
- var urlarg = '';
112
+
113
+ var urlarg = '';
115
114
  if(null !== expire && !isNaN(expire)){
116
- urlarg = '?expire=' + String(expire);
115
+ urlarg = '?expire=' + String(expire);
117
116
  }
118
- var options = { 'host': hostname,
119
- 'port': hostport,
120
- 'path': '/v1/role/token/' + name + urlarg,
121
- 'method': 'GET',
122
- 'headers': headers
123
- };
124
- /* eslint-enable indent, no-mixed-spaces-and-tabs */
117
+
118
+ var options = {
119
+ 'host': hostname,
120
+ 'port': hostport,
121
+ 'path': '/v1/role/token/' + name + urlarg,
122
+ 'method': 'GET',
123
+ 'headers': headers
124
+ };
125
125
 
126
126
  r3logger.dlog('request options = ' + JSON.stringify(options));
127
127
  r3logger.dlog('request headers = ' + JSON.stringify(headers));
@@ -169,21 +169,20 @@ function getV1RoleToken(token, name, expire)
169
169
 
170
170
  function getV1RoleTokenList(token, name, expand)
171
171
  {
172
- /* eslint-disable indent, no-mixed-spaces-and-tabs */
173
- var headers = {
174
- 'Content-Type': 'application/json',
175
- 'Content-Length': 0,
176
- };
172
+ var headers = {
173
+ 'Content-Type': 'application/json',
174
+ 'Content-Length': 0,
175
+ };
177
176
  if(apiutil.isSafeString(token)){
178
177
  headers['X-Auth-Token'] = token;
179
178
  }
180
- var options = { 'host': hostname,
181
- 'port': hostport,
182
- 'path': '/v1/role/token/list/' + name + (expand ? '?expand=true' : '?expand=false'),
183
- 'method': 'GET',
184
- 'headers': headers
185
- };
186
- /* eslint-enable indent, no-mixed-spaces-and-tabs */
179
+ var options = {
180
+ 'host': hostname,
181
+ 'port': hostport,
182
+ 'path': '/v1/role/token/list/' + name + (expand ? '?expand=true' : '?expand=false'),
183
+ 'method': 'GET',
184
+ 'headers': headers
185
+ };
187
186
 
188
187
  r3logger.dlog('request options = ' + JSON.stringify(options));
189
188
  r3logger.dlog('request headers = ' + JSON.stringify(headers));
@@ -231,17 +230,17 @@ function getV1RoleTokenList(token, name, expand)
231
230
 
232
231
  function headV1Role(token, roleyrn, port, cuk)
233
232
  {
234
- /* eslint-disable indent, no-mixed-spaces-and-tabs */
235
- var headers = {
236
- 'Content-Type': 'application/json',
237
- 'Content-Length': 0
238
- };
233
+ var headers = {
234
+ 'Content-Type': 'application/json',
235
+ 'Content-Length': 0
236
+ };
239
237
  if(apiutil.isSafeString(token)){
240
238
  headers['X-Auth-Token'] = token;
241
239
  }
242
- var urlargs = '';
240
+
241
+ var urlargs = '';
243
242
  if(null !== port){
244
- urlargs = '?port=' + String(port);
243
+ urlargs = '?port=' + String(port);
245
244
  }
246
245
  if(apiutil.isSafeString(cuk)){
247
246
  if(apiutil.isSafeString(urlargs)){
@@ -251,13 +250,14 @@ function headV1Role(token, roleyrn, port, cuk)
251
250
  }
252
251
  urlargs += cuk;
253
252
  }
254
- var options = { 'host': hostname,
255
- 'port': hostport,
256
- 'path': '/v1/role/' + roleyrn + urlargs,
257
- 'method': 'HEAD',
258
- 'headers': headers
259
- };
260
- /* eslint-enable indent, no-mixed-spaces-and-tabs */
253
+
254
+ var options = {
255
+ 'host': hostname,
256
+ 'port': hostport,
257
+ 'path': '/v1/role/' + roleyrn + urlargs,
258
+ 'method': 'HEAD',
259
+ 'headers': headers
260
+ };
261
261
 
262
262
  r3logger.dlog('request options = ' + JSON.stringify(options));
263
263
  r3logger.dlog('request headers = ' + JSON.stringify(headers));
@@ -42,27 +42,25 @@ var is_https = apiutil.compareCaseString('yes', process.env.HTTPS_ENV);
42
42
  //
43
43
  function postV1Role(method, token, name, policies, alias)
44
44
  {
45
- /* eslint-disable indent, no-mixed-spaces-and-tabs */
46
- var strbody = '';
47
- var headers = {
48
- 'Content-Type': 'application/json',
49
- 'X-Auth-Token': token
50
- };
51
- var options = { 'host': hostname,
52
- 'port': hostport,
53
- 'method': method
54
- };
55
- /* eslint-enable indent, no-mixed-spaces-and-tabs */
45
+ var strbody = '';
46
+ var headers = {
47
+ 'Content-Type': 'application/json',
48
+ 'X-Auth-Token': token
49
+ };
50
+ var options = {
51
+ 'host': hostname,
52
+ 'port': hostport,
53
+ 'method': method
54
+ };
56
55
 
57
56
  if(apiutil.compareCaseString('post', method)){
58
- /* eslint-disable indent, no-mixed-spaces-and-tabs */
59
- var body = { 'role':
60
- { 'name': name,
61
- 'policies': policies,
62
- 'alias': alias
63
- }
64
- };
65
- /* eslint-enable indent, no-mixed-spaces-and-tabs */
57
+ var body = {
58
+ 'role': {
59
+ 'name': name,
60
+ 'policies': policies,
61
+ 'alias': alias
62
+ }
63
+ };
66
64
 
67
65
  strbody = JSON.stringify(body);
68
66
  headers['Content-Length'] = strbody.length;
@@ -149,18 +147,17 @@ function postV1Role(method, token, name, policies, alias)
149
147
 
150
148
  function postV1RoleHost(method, is_user_token, token, name, target_host, port, cuk, extra, tag, inboundip, outboundip)
151
149
  {
152
- /* eslint-disable indent, no-mixed-spaces-and-tabs */
153
- var strbody = '';
154
- var _token = (is_user_token ? ('U=' + token) : ('R=' + token));
155
- var headers = {
156
- 'Content-Type': 'application/json',
157
- 'X-Auth-Token': _token
158
- };
159
- var options = { 'host': hostname,
160
- 'port': hostport,
161
- 'method': method
162
- };
163
- /* eslint-enable indent, no-mixed-spaces-and-tabs */
150
+ var strbody = '';
151
+ var _token = (is_user_token ? ('U=' + token) : ('R=' + token));
152
+ var headers = {
153
+ 'Content-Type': 'application/json',
154
+ 'X-Auth-Token': _token
155
+ };
156
+ var options = {
157
+ 'host': hostname,
158
+ 'port': hostport,
159
+ 'method': method
160
+ };
164
161
 
165
162
  if(apiutil.compareCaseString('post', method)){
166
163
  var host_info = {};
@@ -47,19 +47,17 @@ function rawDeleteV1Service(token, service, tenant)
47
47
  basepath += '?tenant=' + encodeURI(tenant);
48
48
  }
49
49
 
50
- /* eslint-disable indent, no-mixed-spaces-and-tabs */
51
- var headers = {
52
- 'Content-Type': 'application/json',
53
- 'X-Auth-Token': 'U=' + token
54
- };
55
- var options = {
56
- 'host': hostname,
57
- 'port': hostport,
58
- 'path': basepath,
59
- 'method': 'DELETE',
60
- 'headers': headers
61
- };
62
- /* eslint-enable indent, no-mixed-spaces-and-tabs */
50
+ var headers = {
51
+ 'Content-Type': 'application/json',
52
+ 'X-Auth-Token': 'U=' + token
53
+ };
54
+ var options = {
55
+ 'host': hostname,
56
+ 'port': hostport,
57
+ 'path': basepath,
58
+ 'method': 'DELETE',
59
+ 'headers': headers
60
+ };
63
61
 
64
62
  r3logger.dlog('request options = ' + JSON.stringify(options));
65
63
  r3logger.dlog('request headers = ' + JSON.stringify(headers));
@@ -42,24 +42,22 @@ var is_https = apiutil.compareCaseString('yes', process.env.HTTPS_ENV);
42
42
  //
43
43
  function rawGetHeadV1Service(method, token, service, tenant)
44
44
  {
45
- var basepath = '/v1/service/' + service;
45
+ var basepath = '/v1/service/' + service;
46
46
  if(apiutil.compareCaseString('HEAD', method) && apiutil.isSafeString(tenant)){
47
- basepath += '?tenant=' + encodeURI(tenant);
47
+ basepath += '?tenant=' + encodeURI(tenant);
48
48
  }
49
49
 
50
- /* eslint-disable indent, no-mixed-spaces-and-tabs */
51
- var headers = {
52
- 'Content-Type': 'application/json',
53
- 'X-Auth-Token': 'U=' + token
54
- };
55
- var options = {
56
- 'host': hostname,
57
- 'port': hostport,
58
- 'path': basepath,
59
- 'method': method,
60
- 'headers': headers
61
- };
62
- /* eslint-enable indent, no-mixed-spaces-and-tabs */
50
+ var headers = {
51
+ 'Content-Type': 'application/json',
52
+ 'X-Auth-Token': 'U=' + token
53
+ };
54
+ var options = {
55
+ 'host': hostname,
56
+ 'port': hostport,
57
+ 'path': basepath,
58
+ 'method': method,
59
+ 'headers': headers
60
+ };
63
61
 
64
62
  r3logger.dlog('request options = ' + JSON.stringify(options));
65
63
  r3logger.dlog('request headers = ' + JSON.stringify(headers));
@@ -116,17 +116,16 @@ function rawPutPostV1Service(method, token, service, is_create, verify, is_verif
116
116
  }
117
117
  }
118
118
 
119
- /* eslint-disable indent, no-mixed-spaces-and-tabs */
120
- var headers = {
121
- 'Content-Type': 'application/json',
122
- 'X-Auth-Token': 'U=' + token
123
- };
124
- var options = { 'host': hostname,
125
- 'port': hostport,
126
- 'path': basepath,
127
- 'method': method
128
- };
129
- /* eslint-enable indent, no-mixed-spaces-and-tabs */
119
+ var headers = {
120
+ 'Content-Type': 'application/json',
121
+ 'X-Auth-Token': 'U=' + token
122
+ };
123
+ var options = {
124
+ 'host': hostname,
125
+ 'port': hostport,
126
+ 'path': basepath,
127
+ 'method': method
128
+ };
130
129
 
131
130
  if(apiutil.compareCaseString('POST', method)){
132
131
  headers['Content-Length'] = strbody.length;
@@ -158,11 +158,11 @@ while [ $# -ne 0 ]; do
158
158
  if [ -z "$1" ]; then
159
159
  break
160
160
 
161
- elif [ "$1" = "-h" ] || [ "$1" = "-H" ] || [ "$1" = "--help" ] || [ "$1" = "--HELP" ]; then
161
+ elif echo "$1" | grep -q -i -e "^-h$" -e "^--help$"; then
162
162
  PrintUsage "${PRGNAME}"
163
163
  exit 0
164
164
 
165
- elif [ "$1" = "-a" ] || [ "$1" = "-A" ] || [ "$1" = "--apihost" ] || [ "$1" = "--APIHOST" ]; then
165
+ elif echo "$1" | grep -q -i -e "^-a$" -e "^--apihost$"; then
166
166
  #
167
167
  # API HOST
168
168
  #
@@ -177,7 +177,7 @@ while [ $# -ne 0 ]; do
177
177
  fi
178
178
  APIHOST="$1"
179
179
 
180
- elif [ "$1" = "-p" ] || [ "$1" = "-P" ] || [ "$1" = "--apiport" ] || [ "$1" = "--APIPORT" ]; then
180
+ elif echo "$1" | grep -q -i -e "^-p$" -e "^--apiport$"; then
181
181
  #
182
182
  # API PORT
183
183
  #
@@ -199,21 +199,21 @@ while [ $# -ne 0 ]; do
199
199
  fi
200
200
  APIPORT="$1"
201
201
 
202
- elif [ "$1" = "--https" ] || [ "$1" = "--HTTPS" ]; then
202
+ elif echo "$1" | grep -q -i "^--https$"; then
203
203
  if [ -n "${HTTPS_ENV}" ]; then
204
204
  echo "[ERROR] already specified --https or --http option"
205
205
  exit 1
206
206
  fi
207
207
  HTTPS_ENV="yes"
208
208
 
209
- elif [ "$1" = "--http" ] || [ "$1" = "--HTTP" ]; then
209
+ elif echo "$1" | grep -q -i "^--http$"; then
210
210
  if [ -n "${HTTPS_ENV}" ]; then
211
211
  echo "[ERROR] already specified --https or --http option"
212
212
  exit 1
213
213
  fi
214
214
  HTTPS_ENV="no"
215
215
 
216
- elif [ "$1" = "-d" ] || [ "$1" = "-D" ] || [ "$1" = "--debuglevel" ] || [ "$1" = "--DEBUGLEVEL" ]; then
216
+ elif echo "$1" | grep -q -i -e "^-d$" -e "^--debuglevel$"; then
217
217
  #
218
218
  # DEBUG option
219
219
  #
@@ -222,25 +222,25 @@ while [ $# -ne 0 ]; do
222
222
  echo "[ERROR] --debuglevel(-d) option needs parameter(dbg/msg/warn/err)"
223
223
  exit 1
224
224
  fi
225
- if [ "$1" = "dbg" ] || [ "$1" = "DBG" ] || [ "$1" = "debug" ] || [ "$1" = "DEBUG" ]; then
225
+ if echo "$1" | grep -q -i -e "^dbg$" -e "^debug$"; then
226
226
  if [ "${DEBUG_ENV_LEVEL}" -ne 0 ]; then
227
227
  echo "[ERROR] --debuglevel(-d) option already is set"
228
228
  exit 1
229
229
  fi
230
230
  DEBUG_ENV_LEVEL=4
231
- elif [ "$1" = "msg" ] || [ "$1" = "MSG" ] || [ "$1" = "message" ] || [ "$1" = "MESSAGE" ] || [ "$1" = "info" ] || [ "$1" = "INFO" ]; then
231
+ elif echo "$1" | grep -q -i -e "^msg$" -e "^message$" -e "^info$"; then
232
232
  if [ "${DEBUG_ENV_LEVEL}" -ne 0 ]; then
233
233
  echo "[ERROR] --debuglevel(-d) option already is set"
234
234
  exit 1
235
235
  fi
236
236
  DEBUG_ENV_LEVEL=3
237
- elif [ "$1" = "warn" ] || [ "$1" = "WARN" ] || [ "$1" = "warning" ] || [ "$1" = "WARNING" ]; then
237
+ elif echo "$1" | grep -q -i -e "^wan$" -e "^warn$" -e "^warning$"; then
238
238
  if [ "${DEBUG_ENV_LEVEL}" -ne 0 ]; then
239
239
  echo "[ERROR] --debuglevel(-d) option already is set"
240
240
  exit 1
241
241
  fi
242
242
  DEBUG_ENV_LEVEL=2
243
- elif [ "$1" = "err" ] || [ "$1" = "ERR" ] || [ "$1" = "error" ] || [ "$1" = "ERROR" ]; then
243
+ elif echo "$1" | grep -q -i -e "^err$" -e "^error$"; then
244
244
  if [ "${DEBUG_ENV_LEVEL}" -ne 0 ]; then
245
245
  echo "[ERROR] --debuglevel(-d) option already is set"
246
246
  exit 1
@@ -43,25 +43,24 @@ var is_https = apiutil.compareCaseString('yes', process.env.HTTPS_ENV);
43
43
  //
44
44
  function getV1UserData(registerpath, is_gzip)
45
45
  {
46
- /* eslint-disable indent, no-mixed-spaces-and-tabs */
47
46
  var headers;
48
47
  if(is_gzip){
49
- headers = {
50
- 'Content-Type': 'application/octet-stream',
51
- 'User-Agent': 'Cloud-Init',
52
- 'Accept-Encoding': 'gzip'
53
- };
48
+ headers = {
49
+ 'Content-Type': 'application/octet-stream',
50
+ 'User-Agent': 'Cloud-Init',
51
+ 'Accept-Encoding': 'gzip'
52
+ };
54
53
  }else{
55
- headers = {
56
- 'Content-Type': 'application/octet-stream',
57
- 'User-Agent': 'Cloud-Init'
58
- };
54
+ headers = {
55
+ 'Content-Type': 'application/octet-stream',
56
+ 'User-Agent': 'Cloud-Init'
57
+ };
59
58
  }
60
- var options = { 'host': hostname,
61
- 'port': hostport,
62
- 'method': 'GET'
63
- };
64
- /* eslint-enable indent, no-mixed-spaces-and-tabs */
59
+ var options = {
60
+ 'host': hostname,
61
+ 'port': hostport,
62
+ 'method': 'GET'
63
+ };
65
64
 
66
65
  options.headers = headers;
67
66
  options.path = '/v1/userdata/' + encodeURI(registerpath);
@@ -42,20 +42,18 @@ var is_https = apiutil.compareCaseString('yes', process.env.HTTPS_ENV);
42
42
  //
43
43
  function headV1UserTokens(token, method)
44
44
  {
45
- /* eslint-disable indent, no-mixed-spaces-and-tabs */
46
- var headers = {
47
- 'Content-Type': 'application/json',
48
- 'Content-Length': 0,
49
- 'X-Auth-Token': token
50
- };
51
- var options = {
52
- 'host': hostname,
53
- 'port': hostport,
54
- 'path': '/v1/user/tokens',
55
- 'method': method,
56
- 'headers': headers
57
- };
58
- /* eslint-enable indent, no-mixed-spaces-and-tabs */
45
+ var headers = {
46
+ 'Content-Type': 'application/json',
47
+ 'Content-Length': 0,
48
+ 'X-Auth-Token': token
49
+ };
50
+ var options = {
51
+ 'host': hostname,
52
+ 'port': hostport,
53
+ 'path': '/v1/user/tokens',
54
+ 'method': method,
55
+ 'headers': headers
56
+ };
59
57
 
60
58
  r3logger.dlog('request options = ' + JSON.stringify(options));
61
59
  r3logger.dlog('request headers = ' + JSON.stringify(headers));
@@ -42,16 +42,15 @@ var is_https = apiutil.compareCaseString('yes', process.env.HTTPS_ENV);
42
42
  //
43
43
  function postV1UserTokens(method, token, othertoken, user, passwd, tenant)
44
44
  {
45
- /* eslint-disable indent, no-mixed-spaces-and-tabs */
46
- var headers = {
47
- 'Content-Type': 'application/json'
48
- };
49
- var options = { 'host': hostname,
50
- 'port': hostport,
51
- 'method': method
52
- };
53
- var strbody = '';
54
- /* eslint-enable indent, no-mixed-spaces-and-tabs */
45
+ var headers = {
46
+ 'Content-Type': 'application/json'
47
+ };
48
+ var options = {
49
+ 'host': hostname,
50
+ 'port': hostport,
51
+ 'method': method
52
+ };
53
+ var strbody = '';
55
54
 
56
55
  // set token if exists
57
56
  var is_user_cred_type = true;
@@ -66,26 +65,24 @@ function postV1UserTokens(method, token, othertoken, user, passwd, tenant)
66
65
  if(apiutil.compareCaseString('post', method)){
67
66
  // case for POST
68
67
 
69
- /* eslint-disable indent, no-mixed-spaces-and-tabs */
70
68
  var body;
71
69
  if(is_user_cred_type){
72
- body = {
73
- 'auth': {
74
- 'tenantName': apiutil.isSafeString(tenant) ? tenant : '',
75
- 'passwordCredentials': {
76
- 'username': user,
77
- 'password': passwd
78
- }
79
- }
80
- };
70
+ body = {
71
+ 'auth': {
72
+ 'tenantName': apiutil.isSafeString(tenant) ? tenant : '',
73
+ 'passwordCredentials': {
74
+ 'username': user,
75
+ 'password': passwd
76
+ }
77
+ }
78
+ };
81
79
  }else{
82
- body = {
83
- 'auth': {
84
- 'tenantName': apiutil.isSafeString(tenant) ? tenant : ''
85
- }
86
- };
80
+ body = {
81
+ 'auth': {
82
+ 'tenantName': apiutil.isSafeString(tenant) ? tenant : ''
83
+ }
84
+ };
87
85
  }
88
- /* eslint-enable indent, no-mixed-spaces-and-tabs */
89
86
 
90
87
  strbody = JSON.stringify(body);
91
88
  headers['Content-Length'] = strbody.length;