irods  4.2.8
About: iRODS (the integrated Rule Oriented Data System) is a distributed data-management system for creating data grids, digital libraries, persistent archives, and real-time data systems.
  Fossies Dox: irods-4.2.8.tar.gz  ("unofficial" and yet experimental doxygen-generated source code documentation)  

rsGeneralAdmin.cpp
Go to the documentation of this file.
1 
3 /* This is script-generated code (for the most part). */
4 /* See generalAdmin.h for a description of this API call.*/
5 
6 // =-=-=-=-=-=-=-
7 // irods includes
8 #include "generalAdmin.h"
9 #include "rodsConnect.h"
11 #include "miscServerFunct.hpp"
12 #include "rsGeneralAdmin.hpp"
13 #include "rsModAVUMetadata.hpp"
14 #include "rsGenQuery.hpp"
15 
16 // =-=-=-=-=-=-=-
17 // stl includes
18 #include <iostream>
19 #include <string>
20 #include <tuple>
21 
22 // =-=-=-=-=-=-=-
27 #include "irods_file_object.hpp"
29 #include "irods_load_plugin.hpp"
30 #include "irods_at_scope_exit.hpp"
32 
33 // =-=-=-=-=-=-=-
34 // boost includes
35 #include <boost/date_time.hpp>
36 #include <boost/optional.hpp>
37 
39 
41  rsComm_t* _rsComm,
42  const std::string& _resource_name) {
43 
44  // build genquery to find active or stale "rebalance operation" entries for this resource
45  genQueryOut_t* gen_out = nullptr;
46  char tmp_str[MAX_NAME_LEN];
47  genQueryInp_t gen_inp{};
48 
49  snprintf( tmp_str, MAX_NAME_LEN, "='%s'", _resource_name.c_str() );
50  addInxVal( &gen_inp.sqlCondInp, COL_R_RESC_NAME, tmp_str );
51  snprintf( tmp_str, MAX_NAME_LEN, "='rebalance_operation'" );
52  addInxVal( &gen_inp.sqlCondInp, COL_META_RESC_ATTR_NAME, tmp_str );
53  addInxIval( &gen_inp.selectInp, COL_META_RESC_ATTR_VALUE, 1 );
54  addInxIval( &gen_inp.selectInp, COL_META_RESC_ATTR_UNITS, 1 );
55  gen_inp.maxRows = 1;
56  int status = rsGenQuery( _rsComm, &gen_inp, &gen_out );
57  // if existing entry found, report and exit
58  if ( status >= 0 ) {
59  sqlResult_t* hostname_and_pid;
60  sqlResult_t* timestamp;
61  if ( ( hostname_and_pid = getSqlResultByInx( gen_out, COL_META_RESC_ATTR_VALUE ) ) == nullptr ) {
62  rodsLog( LOG_ERROR, "%s: getSqlResultByInx for COL_META_RESC_ATTR_VALUE failed", __FUNCTION__ );
64  }
65  if ( ( timestamp = getSqlResultByInx( gen_out, COL_META_RESC_ATTR_UNITS ) ) == nullptr ) {
66  rodsLog( LOG_ERROR, "%s: getSqlResultByInx for COL_META_RESC_ATTR_UNITS failed", __FUNCTION__ );
68  }
69  std::stringstream msg;
70  msg << "A rebalance_operation on resource [";
71  msg << _resource_name.c_str();
72  msg << "] is still active (or stale) [";
73  msg << &hostname_and_pid->value[0];
74  msg << "] [";
75  msg << &timestamp->value[0];
76  msg << "]";
77  rodsLog( LOG_ERROR, "%s: %s", __FUNCTION__, msg.str().c_str() );
78  addRErrorMsg( &_rsComm->rError, REBALANCE_ALREADY_ACTIVE_ON_RESOURCE, msg.str().c_str() );
80  }
81  freeGenQueryOut( &gen_out );
82  clearGenQueryInp( &gen_inp );
83  return 0;
84 }
85 
87  rsComm_t* _rsComm,
88  const std::string& _resource_name) {
89 
90  modAVUMetadataInp_t modAVUMetadataInp{};
91  irods::at_scope_exit<std::function<void()>> at_scope_exit{[&] {
92  free( modAVUMetadataInp.arg0 );
93  free( modAVUMetadataInp.arg1 );
94  free( modAVUMetadataInp.arg2 );
95  free( modAVUMetadataInp.arg3 );
96  free( modAVUMetadataInp.arg4 );
97  free( modAVUMetadataInp.arg5 );
98  }};
99  // get hostname
100  char hostname[MAX_NAME_LEN];
101  gethostname(hostname, MAX_NAME_LEN);
102  // get PID
103  int pid = getpid();
104  // get timestamp in defined format
105  const boost::posix_time::ptime timeUTC = boost::posix_time::second_clock::universal_time();
106  std::stringstream stream;
107  boost::posix_time::time_facet* facet = new boost::posix_time::time_facet();
108  facet->format("%Y%m%dT%H%M%SZ");
109  stream.imbue(std::locale(std::locale::classic(), facet));
110  stream << timeUTC;
111  // add AVU to resource
112  modAVUMetadataInp.arg0 = strdup( "set" );
113  modAVUMetadataInp.arg1 = strdup( "-R" );
114  modAVUMetadataInp.arg2 = strdup( _resource_name.c_str() );
115  modAVUMetadataInp.arg3 = strdup( "rebalance_operation" );
116  std::string value = std::string(hostname) + std::string(":") + std::to_string(pid);
117  modAVUMetadataInp.arg4 = strdup( value.c_str() );
118  std::string unit = stream.str();
119  modAVUMetadataInp.arg5 = strdup( unit.c_str() );
120  // do it
121  return rsModAVUMetadata( _rsComm, &modAVUMetadataInp );
122 }
123 
125  rsComm_t* _rsComm,
126  const std::string& _resource_name) {
127 
128  int status = _check_rebalance_timestamp_avu_on_resource(_rsComm, _resource_name);
129  if (status < 0 ){
130  return status;
131  }
132  status = _set_rebalance_timestamp_avu_on_resource(_rsComm, _resource_name);
133  if (status < 0 ){
134  return status;
135  }
136  return 0;
137 }
138 
140  rsComm_t* _rsComm,
141  const std::string& _resource_name) {
142  // build genquery to find active or stale "rebalance operation" entries for this resource
143  genQueryOut_t* gen_out = nullptr;
144  char tmp_str[MAX_NAME_LEN];
145  genQueryInp_t gen_inp{};
146 
147  snprintf( tmp_str, MAX_NAME_LEN, "='%s'", _resource_name.c_str() );
148  addInxVal( &gen_inp.sqlCondInp, COL_R_RESC_NAME, tmp_str );
149  snprintf( tmp_str, MAX_NAME_LEN, "='rebalance_operation'" );
150  addInxVal( &gen_inp.sqlCondInp, COL_META_RESC_ATTR_NAME, tmp_str );
151  addInxIval( &gen_inp.selectInp, COL_META_RESC_ATTR_VALUE, 1 );
152  addInxIval( &gen_inp.selectInp, COL_META_RESC_ATTR_UNITS, 1 );
153  gen_inp.maxRows = 1;
154  int status = rsGenQuery( _rsComm, &gen_inp, &gen_out );
155  // if existing entry found, remove it
156  if ( status >= 0 ) {
157  modAVUMetadataInp_t modAVUMetadataInp{};
158  irods::at_scope_exit<std::function<void()>> at_scope_exit{[&] {
159  free( modAVUMetadataInp.arg0 );
160  free( modAVUMetadataInp.arg1 );
161  free( modAVUMetadataInp.arg2 );
162  free( modAVUMetadataInp.arg3 );
163  free( modAVUMetadataInp.arg4 );
164  free( modAVUMetadataInp.arg5 );
165  }};
166  // remove AVU from resource
167  modAVUMetadataInp.arg0 = strdup( "rmw" );
168  modAVUMetadataInp.arg1 = strdup( "-R" );
169  modAVUMetadataInp.arg2 = strdup( _resource_name.c_str() );
170  modAVUMetadataInp.arg3 = strdup( "rebalance_operation" );
171  modAVUMetadataInp.arg4 = strdup( "%" );
172  modAVUMetadataInp.arg5 = strdup( "%" );
173  // do it
174  return rsModAVUMetadata( _rsComm, &modAVUMetadataInp );
175  }
176  else {
177  return 0;
178  }
179 }
180 
181 
182 int
183 rsGeneralAdmin( rsComm_t *rsComm, generalAdminInp_t *generalAdminInp ) {
185  int status;
186 
187  rodsLog( LOG_DEBUG, "generalAdmin" );
188 
189  status = getAndConnRcatHost( rsComm, MASTER_RCAT, ( const char* )NULL, &rodsServerHost );
190  if ( status < 0 ) {
191  return status;
192  }
193 
194  if ( rodsServerHost->localFlag == LOCAL_HOST ) {
195  std::string svc_role;
196  irods::error ret = get_catalog_service_role(svc_role);
197  if(!ret.ok()) {
198  irods::log(PASS(ret));
199  return ret.code();
200  }
201 
202  if( irods::CFG_SERVICE_ROLE_PROVIDER == svc_role ) {
203  status = _rsGeneralAdmin( rsComm, generalAdminInp );
204  } else if( irods::CFG_SERVICE_ROLE_CONSUMER == svc_role ) {
206  } else {
207  rodsLog(
208  LOG_ERROR,
209  "role not supported [%s]",
210  svc_role.c_str() );
212  }
213  }
214  else {
216  generalAdminInp );
217 
218  // =-=-=-=-=-=-=-
219  // always replicate the error stack [#2184] for 'iadmin lt' reporting
220  // back to the client if it had been redirected
222 
223  }
224  if ( status < 0 ) {
226  "rsGeneralAdmin: rcGeneralAdmin error %d", status );
227  }
228  return status;
229 }
230 
231 int _addChildToResource(generalAdminInp_t* _generalAdminInp, rsComm_t* _rsComm)
232 {
233  int result = 0;
234  std::map<std::string, std::string> resc_input;
235 
236  {
237  const auto length_exceeded = [](const auto& _resource_name)
238  {
239  return std::strlen(_resource_name) >= NAME_LEN;
240  };
241 
242  if (length_exceeded(_generalAdminInp->arg2) || length_exceeded(_generalAdminInp->arg3)) {
244  }
245 
246  // If the resource names are the same, then return an error.
247  if (std::strncmp(_generalAdminInp->arg2, _generalAdminInp->arg3, NAME_LEN) == 0) {
248  std::string msg = "Cannot add resource [";
249  msg += _generalAdminInp->arg3;
250  msg += "] as child to itself.";
251 
252  // TODO Investigate how to detect the verbose flag.
253  // Add this message to the rError stack should happen automatically.
254  // The apiHandler does not know about the verbose flag for iadmin yet.
255  addRErrorMsg(&_rsComm->rError, HIERARCHY_ERROR, msg.c_str());
256  rodsLog(LOG_ERROR, msg.c_str());
257 
258  return HIERARCHY_ERROR;
259  }
260 
261  // Case 1: Return CHILD_HAS_PARENT if the child has a parent resource.
262  // Case 2: Return HIERARCHY_ERROR if the child is a parent of the parent.
263 
264  const auto is_root_resource = [](const auto& _resource_name) -> std::tuple<irods::error, boost::optional<bool>>
265  {
266  std::string hier;
267  auto err = resc_mgr.get_hier_to_root_for_resc(_resource_name, hier);
268 
269  if (!err.ok()) {
270  return std::make_tuple(err, boost::none);
271  }
272 
273  irods::hierarchy_parser hier_parser;
274  hier_parser.set_string(hier);
275 
276  int levels = 0;
277  err = hier_parser.num_levels(levels);
278 
279  if (!err.ok()) {
280  return std::make_tuple(err, boost::none);
281  }
282 
283  return {SUCCESS(), 1 == levels};
284  };
285 
286  {
287  // Return an error if the child resource already has a parent.
288  auto result = is_root_resource(_generalAdminInp->arg3);
289  auto& err = std::get<0>(result);
290  auto& res = std::get<1>(result);
291 
292  if (err.ok()) {
293  if (res && !*res) {
294  std::string msg = "Child resource [";
295  msg += _generalAdminInp->arg3;
296  msg += "] already has a parent resource.";
297 
298  addRErrorMsg(&_rsComm->rError, CHILD_HAS_PARENT, msg.c_str());
299  rodsLog(LOG_ERROR, msg.c_str());
300 
301  return CHILD_HAS_PARENT;
302  }
303  }
304  // The resource manager returns a different error code when a resource doesn't exist.
305  // If "SYS_RESC_DOES_NOT_EXIST" is returned, make sure to translate it to the
306  // appropriate error code to maintain backwards compatibility.
307  else if (err.code() == SYS_RESC_DOES_NOT_EXIST) {
308  addRErrorMsg(&_rsComm->rError, CHILD_NOT_FOUND, err.user_result().c_str());
309  rodsLog(LOG_ERROR, err.result().c_str());
310  return CHILD_NOT_FOUND;
311  }
312  else {
313  addRErrorMsg(&_rsComm->rError, err.code(), err.user_result().c_str());
314  rodsLog(LOG_ERROR, err.result().c_str());
315  return err.code();
316  }
317  }
318 
319  std::string hier;
320  const auto err = resc_mgr.get_hier_to_root_for_resc(_generalAdminInp->arg2, hier);
321 
322  if (!err.ok()) {
323  // The resource manager returns a different error code when a resource doesn't exist.
324  // If "SYS_RESC_DOES_NOT_EXIST" is returned, make sure to translate it to the
325  // appropriate error code to maintain backwards compatibility.
326  if (err.code() == SYS_RESC_DOES_NOT_EXIST) {
327  addRErrorMsg(&_rsComm->rError, CAT_INVALID_RESOURCE, err.user_result().c_str());
328  rodsLog(LOG_ERROR, err.result().c_str());
329  return CAT_INVALID_RESOURCE;
330  }
331 
332  addRErrorMsg(&_rsComm->rError, err.code(), err.user_result().c_str());
333  rodsLog(LOG_ERROR, err.result().c_str());
334  return err.code();
335  }
336 
337  irods::hierarchy_parser hier_parser;
338  hier_parser.set_string(hier);
339 
340  // Return an error if the child resource is an ancestor of the parent resource.
341  const auto end = std::end(hier_parser);
342  if (std::find(std::begin(hier_parser), end, _generalAdminInp->arg3) != end)
343  {
344  std::string msg = "Cannot add ancestor resource [";
345  msg += _generalAdminInp->arg3;
346  msg += "] as child to descendant resource [";
347  msg += _generalAdminInp->arg2;
348  msg += "].";
349 
350  addRErrorMsg(&_rsComm->rError, HIERARCHY_ERROR, msg.c_str());
351  rodsLog(LOG_ERROR, msg.c_str());
352 
353  return HIERARCHY_ERROR;
354  }
355  }
356 
357  resc_input[irods::RESOURCE_NAME] = _generalAdminInp->arg2;
358 
359  std::string rescChild( _generalAdminInp->arg3 );
360  std::string rescContext( _generalAdminInp->arg4 );
361 
362  if (rescContext.find(';') != std::string::npos) {
363  rodsLog(LOG_ERROR, "_addChildToResource: semicolon ';' not allowed in child context string [%s]", rescContext.c_str());
365  }
366 
367  if (rescContext.find('{') != std::string::npos) {
368  rodsLog(LOG_ERROR, "_addChildToResource: open curly bracket '{' not allowed in child context string [%s]", rescContext.c_str());
370  }
371 
372  if (rescContext.find('}') != std::string::npos) {
373  rodsLog(LOG_ERROR, "_addChildToResource: close curly bracket '}' not allowed in child context string [%s]", rescContext.c_str());
375  }
376 
378  parser.add_child( rescChild, rescContext );
379  std::string rescChildren;
380  parser.str( rescChildren );
381  if ( rescChildren.length() >= MAX_PATH_ALLOWED ) {
383  }
384 
385  resc_input[irods::RESOURCE_CHILDREN] = rescChildren;
386 
387  rodsLog( LOG_NOTICE, "rsGeneralAdmin add child \"%s\" to resource \"%s\"", rescChildren.c_str(),
388  resc_input[irods::RESOURCE_NAME].c_str() );
389 
390  if ( ( result = chlAddChildResc( _rsComm, resc_input ) ) != 0 ) {
391  chlRollback( _rsComm );
392  }
393 
394  return result;
395 }
396 
397 int
399  generalAdminInp_t* _generalAdminInp,
400  rsComm_t* _rsComm ) {
401 
402  int result = 0;
403  std::map<std::string, std::string> resc_input;
404 
405  if ( strlen( _generalAdminInp->arg2 ) >= NAME_LEN ) { // resource name
407  }
408  resc_input[irods::RESOURCE_NAME] = _generalAdminInp->arg2;
409 
410  if ( strlen( _generalAdminInp->arg3 ) >= MAX_PATH_ALLOWED ) {
412  }
413  resc_input[irods::RESOURCE_CHILDREN] = _generalAdminInp->arg3;
414 
415  rodsLog( LOG_NOTICE, "rsGeneralAdmin remove child \"%s\" from resource \"%s\"", resc_input[irods::RESOURCE_CHILDREN].c_str(),
416  resc_input[irods::RESOURCE_NAME].c_str() );
417 
418  if ( ( result = chlDelChildResc( _rsComm, resc_input ) ) != 0 ) {
419  chlRollback( _rsComm );
420  }
421 
422  return result;
423 }
424 
425 /* extracted out the functionality for adding a resource to the grid - hcj */
426 int
428  generalAdminInp_t* _generalAdminInp,
429  ruleExecInfo_t& _rei2,
430  rsComm_t* _rsComm ) {
431 
432  int result = 0;
433  static const unsigned int argc = 7;
434  const char *args[argc];
435  std::map<std::string, std::string> resc_input;
436 
437  // =-=-=-=-=-=-=-
438  // Legacy checks
439  if ( strlen( _generalAdminInp->arg2 ) >= NAME_LEN ) { // resource name
441  }
442 
443  if ( strlen( _generalAdminInp->arg3 ) >= NAME_LEN ) { // resource type
445  }
446 
447  if ( strlen( _generalAdminInp->arg5 ) >= MAX_PATH_ALLOWED ) { // resource context
449  }
450 
451  if ( strlen( _generalAdminInp->arg6 ) >= NAME_LEN ) { // resource zone
453  }
454 
455  // =-=-=-=-=-=-=-
456  // capture all the parameters
457  resc_input[irods::RESOURCE_NAME] = _generalAdminInp->arg2;
458  resc_input[irods::RESOURCE_TYPE] = _generalAdminInp->arg3;
459  resc_input[irods::RESOURCE_PATH] = _generalAdminInp->arg4;
460  resc_input[irods::RESOURCE_CONTEXT] = _generalAdminInp->arg5;
461  resc_input[irods::RESOURCE_ZONE] = _generalAdminInp->arg6;
463  resc_input[irods::RESOURCE_CHILDREN] = "";
464  resc_input[irods::RESOURCE_PARENT] = "";
465 
466  // =-=-=-=-=-=-=-
467  // if it is not empty, parse out the host:path otherwise
468  // fill in with the EMPTY placeholders
469  if ( !resc_input[irods::RESOURCE_PATH].empty() ) {
470  // =-=-=-=-=-=-=-
471  // separate the location:/vault/path pair
472  std::vector< std::string > tok;
473  irods::string_tokenize( resc_input[irods::RESOURCE_PATH], ":", tok );
474 
475  // =-=-=-=-=-=-=-
476  // if we have exactly 2 tokens, things are going well
477  if ( 2 == tok.size() ) {
478  // =-=-=-=-=-=-=-
479  // location is index 0, path is index 1
480  if ( strlen( tok[0].c_str() ) >= NAME_LEN ) {
482  }
483  resc_input[irods::RESOURCE_LOCATION] = tok[0];
484 
485  if ( strlen( tok[1].c_str() ) >= MAX_NAME_LEN ) {
487  }
488  resc_input[irods::RESOURCE_PATH] = tok[1];
489  }
490 
491  }
492  else {
495  }
496 
497  // =-=-=-=-=-=-=-
498  args[0] = resc_input[irods::RESOURCE_NAME].c_str();
499  args[1] = resc_input[irods::RESOURCE_TYPE].c_str();
500  args[2] = resc_input[irods::RESOURCE_CLASS].c_str();
501  args[3] = resc_input[irods::RESOURCE_LOCATION].c_str();
502  args[4] = resc_input[irods::RESOURCE_PATH].c_str();
503  args[5] = resc_input[irods::RESOURCE_CONTEXT].c_str();
504  args[6] = resc_input[irods::RESOURCE_ZONE].c_str();
505 
506  // =-=-=-=-=-=-=-
507  // Check that there is a plugin matching the resource type
509  // =-=-=-=-=-=-=-
510  // resolve plugin directory
511  std::string plugin_home;
513  if ( !ret.ok() ) {
514  irods::log( PASS( ret ) );
515  return ret.code();
516  }
517 
518  if ( !name_gen.exists( resc_input[irods::RESOURCE_TYPE], plugin_home ) ) {
519  rodsLog(
520  LOG_DEBUG,
521  "No plugin exists to provide resource [%s] of type [%s]",
522  resc_input[irods::RESOURCE_NAME].c_str(),
523  resc_input[irods::RESOURCE_TYPE].c_str() );
524  }
525 
526  // =-=-=-=-=-=-=-
527  // apply preproc policy enforcement point for creating a resource, handle errors
528  if ( ( result = applyRuleArg( "acPreProcForCreateResource", args, argc, &_rei2, NO_SAVE_REI ) ) < 0 ) {
529  if ( _rei2.status < 0 ) {
530  result = _rei2.status;
531  }
532  rodsLog( LOG_ERROR, "rsGeneralAdmin: acPreProcForCreateResource error for %s, stat=%d",
533  resc_input[irods::RESOURCE_NAME].c_str(), result );
534  }
535 
536  // =-=-=-=-=-=-=-
537  // register resource with the metadata catalog, roll back on an error
538  else if ( ( result = chlRegResc( _rsComm, resc_input ) ) != 0 ) {
539  chlRollback( _rsComm );
540  }
541 
542  // =-=-=-=-=-=-=-
543  // apply postproc policy enforcement point for creating a resource, handle errors
544  else if ( ( result = applyRuleArg( "acPostProcForCreateResource", args, argc, &_rei2, NO_SAVE_REI ) ) < 0 ) {
545  if ( _rei2.status < 0 ) {
546  result = _rei2.status;
547  }
548  rodsLog( LOG_ERROR, "rsGeneralAdmin: acPostProcForCreateResource error for %s, stat=%d",
549  resc_input[irods::RESOURCE_NAME].c_str(), result );
550  }
551 
552  return result;
553 }
554 
555 int
557  // =-=-=-=-=-=-=-
558  // resolve plugin directory
559  std::string plugin_home;
561  if ( !ret.ok() ) {
562  irods::log( PASS( ret ) );
563  return ret.code();
564  }
565 
566  int result = 0;
569  ret = name_gen.list_plugins( plugin_home, plugin_list );
570  if ( ret.ok() ) {
571  std::stringstream msg;
572  for ( irods::plugin_name_generator::plugin_list_t::iterator it = plugin_list.begin();
573  result == 0 && it != plugin_list.end(); ++it ) {
574  msg << *it << std::endl;
575  }
576  if ( result == 0 ) {
577  addRErrorMsg( &_rsComm->rError, STDOUT_STATUS, msg.str().c_str() );
578  }
579  }
580  else {
581  std::stringstream msg;
582  msg << __FUNCTION__;
583  msg << " - Failed to generate the list of resource plugins.";
584  irods::error res = PASSMSG( msg.str(), ret );
585  irods::log( res );
586  result = res.code();
587  }
588  return result;
589 }
590 
591 int
592 _rsGeneralAdmin( rsComm_t *rsComm, generalAdminInp_t *generalAdminInp ) {
593  int status;
594  collInfo_t collInfo;
595  ruleExecInfo_t rei;
596  const char *args[MAX_NUM_OF_ARGS_IN_ACTION];
597  int i, argc;
598  ruleExecInfo_t rei2;
599 
600  memset( ( char* )&rei2, 0, sizeof( ruleExecInfo_t ) );
601  rei2.rsComm = rsComm;
602  if ( rsComm != NULL ) {
603  rei2.uoic = &rsComm->clientUser;
604  rei2.uoip = &rsComm->proxyUser;
605  }
606 
607 
609  "_rsGeneralAdmin arg0=%s",
610  generalAdminInp->arg0 );
611 
612  if ( strcmp( generalAdminInp->arg0, "add" ) == 0 ) {
613  if ( strcmp( generalAdminInp->arg1, "user" ) == 0 ) {
614  /* run the acCreateUser rule */
615  memset( ( char* )&rei, 0, sizeof( rei ) );
616  rei.rsComm = rsComm;
617  userInfo_t userInfo;
618  memset( &userInfo, 0, sizeof( userInfo ) );
619  snprintf( userInfo.userName, sizeof( userInfo.userName ), "%s", generalAdminInp->arg2 );
620  snprintf( userInfo.userType, sizeof( userInfo.userType ), "%s", generalAdminInp->arg3 );
621  snprintf( userInfo.rodsZone, sizeof( userInfo.rodsZone ), "%s", generalAdminInp->arg4 );
622  snprintf( userInfo.authInfo.authStr, sizeof( userInfo.authInfo.authStr ), "%s", generalAdminInp->arg5 );
623  rei.uoio = &userInfo;
624  rei.uoic = &rsComm->clientUser;
625  rei.uoip = &rsComm->proxyUser;
626  status = applyRuleArg( "acCreateUser", NULL, 0, &rei, SAVE_REI );
627  if ( status != 0 ) {
628  chlRollback( rsComm );
629  }
630  return status;
631  }
632  if ( strcmp( generalAdminInp->arg1, "dir" ) == 0 ) {
633  memset( ( char* )&collInfo, 0, sizeof( collInfo ) );
634  snprintf( collInfo.collName, sizeof( collInfo.collName ), "%s", generalAdminInp->arg2 );
635  if ( strlen( generalAdminInp->arg3 ) > 0 ) {
636  snprintf( collInfo.collOwnerName, sizeof( collInfo.collOwnerName ), "%s", generalAdminInp->arg3 );
637  status = chlRegCollByAdmin( rsComm, &collInfo );
638  if ( status == 0 ) {
639  if ( !chlCommit( rsComm ) ) {
640  // JMC - ERROR?
641  }
642  }
643  }
644  else {
645  status = chlRegColl( rsComm, &collInfo );
646  }
647  if ( status != 0 ) {
648  chlRollback( rsComm );
649  }
650  return status;
651  }
652  if ( strcmp( generalAdminInp->arg1, "zone" ) == 0 ) {
653  status = chlRegZone( rsComm, generalAdminInp->arg2,
654  generalAdminInp->arg3,
655  generalAdminInp->arg4,
656  generalAdminInp->arg5 );
657  if ( status == 0 ) {
658  if ( strcmp( generalAdminInp->arg3, "remote" ) == 0 ) {
659  memset( ( char* )&collInfo, 0, sizeof( collInfo ) );
660  snprintf( collInfo.collName, sizeof( collInfo.collName ), "/%s", generalAdminInp->arg2 );
661  snprintf( collInfo.collOwnerName, sizeof( collInfo.collOwnerName ), "%s", rsComm->proxyUser.userName );
662  status = chlRegCollByAdmin( rsComm, &collInfo );
663  if ( status == 0 ) {
664  chlCommit( rsComm );
665  }
666  }
667  }
668  return status;
669  } // add user
670 
671  // =-=-=-=-=-=-=-
672  // add a new resource to the data grid
673  if ( strcmp( generalAdminInp->arg1, "resource" ) == 0 ) {
674  return _addResource( generalAdminInp, rei2, rsComm );
675  } // if create resource
676 
677  /* add a child resource to the specified parent resource */
678  if ( strcmp( generalAdminInp->arg1, "childtoresc" ) == 0 ) {
679  return _addChildToResource( generalAdminInp, rsComm );
680  }
681 
682  if ( strcmp( generalAdminInp->arg1, "token" ) == 0 ) {
683  args[0] = generalAdminInp->arg2;
684  args[1] = generalAdminInp->arg3;
685  args[2] = generalAdminInp->arg4;
686  args[3] = generalAdminInp->arg5;
687  args[4] = generalAdminInp->arg6;
688  args[5] = generalAdminInp->arg7;
689  argc = 6;
690  i = applyRuleArg( "acPreProcForCreateToken", args, argc, &rei2, NO_SAVE_REI );
691  if ( i < 0 ) {
692  if ( rei2.status < 0 ) {
693  i = rei2.status;
694  }
696  "rsGeneralAdmin: acPreProcForCreateToken error for %s.%s=%s, stat=%d",
697  args[0], args[1], args[2], i );
698  return i;
699  }
700 
701  status = chlRegToken( rsComm, generalAdminInp->arg2,
702  generalAdminInp->arg3,
703  generalAdminInp->arg4,
704  generalAdminInp->arg5,
705  generalAdminInp->arg6,
706  generalAdminInp->arg7 );
707  if ( status == 0 ) {
708  i = applyRuleArg( "acPostProcForCreateToken", args, argc, &rei2, NO_SAVE_REI );
709  if ( i < 0 ) {
710  if ( rei2.status < 0 ) {
711  i = rei2.status;
712  }
714  "rsGeneralAdmin: acPostProcForCreateToken error for %s.%s=%s, stat=%d",
715  args[0], args[1], args[2], i );
716  return i;
717  }
718  }
719  if ( status != 0 ) {
720  chlRollback( rsComm );
721  }
722  return status;
723  } // token
724 
725  if ( strcmp( generalAdminInp->arg1, "specificQuery" ) == 0 ) {
726  status = chlAddSpecificQuery( rsComm, generalAdminInp->arg2,
727  generalAdminInp->arg3 );
728  return status;
729  }
730 
731  } // add
732 
733  if ( strcmp( generalAdminInp->arg0, "modify" ) == 0 ) {
734  if ( strcmp( generalAdminInp->arg1, "user" ) == 0 ) {
735  args[0] = generalAdminInp->arg2; /* username */
736  args[1] = generalAdminInp->arg3; /* option */
737  /* Since the obfuscated password might contain commas, single or
738  double quotes, etc, it's hard to escape for processing (often
739  causing a seg fault), so for now just pass in a dummy string.
740  It is also unlikely the microservice actually needs the obfuscated
741  password. */
742  args[2] = "obfuscatedPw";
743  argc = 3;
744  i = applyRuleArg( "acPreProcForModifyUser", args, argc, &rei2, NO_SAVE_REI );
745  if ( i < 0 ) {
746  if ( rei2.status < 0 ) {
747  i = rei2.status;
748  }
750  "rsGeneralAdmin: acPreProcForModifyUser error for %s and option %s, stat=%d",
751  args[0], args[1], i );
752  return i;
753  }
754 
755  status = chlModUser( rsComm, generalAdminInp->arg2,
756  generalAdminInp->arg3, generalAdminInp->arg4 );
757 
758  if ( status == 0 ) {
759  i = applyRuleArg( "acPostProcForModifyUser", args, argc, &rei2, NO_SAVE_REI );
760  if ( i < 0 ) {
761  if ( rei2.status < 0 ) {
762  i = rei2.status;
763  }
765  "rsGeneralAdmin: acPostProcForModifyUser error for %s and option %s, stat=%d",
766  args[0], args[1], i );
767  return i;
768  }
769  }
770  if ( status != 0 ) {
771  chlRollback( rsComm );
772  }
773  return status;
774  }
775  if ( strcmp( generalAdminInp->arg1, "group" ) == 0 ) {
776  userInfo_t ui;
777  memset( &ui, 0, sizeof( userInfo_t ) );
778  rei2.uoio = &ui;
779  rstrcpy( ui.userName, generalAdminInp->arg4, NAME_LEN );
780  rstrcpy( ui.rodsZone, generalAdminInp->arg5, NAME_LEN );
781  args[0] = generalAdminInp->arg2; /* groupname */
782  args[1] = generalAdminInp->arg3; /* option */
783  args[2] = generalAdminInp->arg4; /* username */
784  args[3] = generalAdminInp->arg5; /* zonename */
785  argc = 4;
786  i = applyRuleArg( "acPreProcForModifyUserGroup", args, argc, &rei2, NO_SAVE_REI );
787  if ( i < 0 ) {
788  if ( rei2.status < 0 ) {
789  i = rei2.status;
790  }
792  "rsGeneralAdmin: acPreProcForModifyUserGroup error for %s and option %s, stat=%d",
793  args[0], args[1], i );
794  return i;
795  }
796 
797  status = chlModGroup( rsComm, generalAdminInp->arg2,
798  generalAdminInp->arg3, generalAdminInp->arg4,
799  generalAdminInp->arg5 );
800  if ( status == 0 ) {
801  i = applyRuleArg( "acPostProcForModifyUserGroup", args, argc, &rei2, NO_SAVE_REI );
802  if ( i < 0 ) {
803  if ( rei2.status < 0 ) {
804  i = rei2.status;
805  }
807  "rsGeneralAdmin: acPostProcForModifyUserGroup error for %s and option %s, stat=%d",
808  args[0], args[1], i );
809  return i;
810  }
811  }
812  if ( status != 0 ) {
813  chlRollback( rsComm );
814  }
815  return status;
816  }
817  if ( strcmp( generalAdminInp->arg1, "zone" ) == 0 ) {
818  status = chlModZone( rsComm, generalAdminInp->arg2,
819  generalAdminInp->arg3, generalAdminInp->arg4 );
820  if ( status != 0 ) {
821  chlRollback( rsComm );
822  }
823  if ( status == 0 &&
824  strcmp( generalAdminInp->arg3, "name" ) == 0 ) {
825  char oldName[MAX_NAME_LEN];
826  char newName[MAX_NAME_LEN];
827  snprintf( oldName, sizeof( oldName ), "/%s", generalAdminInp->arg2 );
828  snprintf( newName, sizeof( newName ), "%s", generalAdminInp->arg4 );
829  status = chlRenameColl( rsComm, oldName, newName );
830  if ( status == 0 ) {
831  chlCommit( rsComm );
832  }
833  }
834  return status;
835  }
836  if ( strcmp( generalAdminInp->arg1, "zonecollacl" ) == 0 ) {
837  status = chlModZoneCollAcl( rsComm, generalAdminInp->arg2,
838  generalAdminInp->arg3, generalAdminInp->arg4 );
839  return status;
840  }
841  if ( strcmp( generalAdminInp->arg1, "localzonename" ) == 0 ) {
842  /* run the acRenameLocalZone rule */
843  const char *args[2];
844  memset( ( char* )&rei, 0, sizeof( rei ) );
845  rei.rsComm = rsComm;
846  memset( ( char* )&rei, 0, sizeof( rei ) );
847  rei.rsComm = rsComm;
848  rei.uoic = &rsComm->clientUser;
849  rei.uoip = &rsComm->proxyUser;
850  args[0] = generalAdminInp->arg2;
851  args[1] = generalAdminInp->arg3;
852  status = applyRuleArg( "acRenameLocalZone", args, 2, &rei,
853  NO_SAVE_REI );
854  return status;
855  }
856  if ( strcmp( generalAdminInp->arg1, "resourcedatapaths" ) == 0 ) {
857  status = chlModRescDataPaths( rsComm, generalAdminInp->arg2,
858  generalAdminInp->arg3, generalAdminInp->arg4,
859  generalAdminInp->arg5 );
860 
861  return status;
862  }
863  if ( strcmp( generalAdminInp->arg1, "resource" ) == 0 ) {
864 
865  args[0] = generalAdminInp->arg2; /* rescname */
866  args[1] = generalAdminInp->arg3; /* option */
867  args[2] = generalAdminInp->arg4; /* newvalue */
868  argc = 3;
869  i = applyRuleArg( "acPreProcForModifyResource", args, argc, &rei2, NO_SAVE_REI );
870  if ( i < 0 ) {
871  if ( rei2.status < 0 ) {
872  i = rei2.status;
873  }
875  "rsGeneralAdmin: acPreProcForModifyResource error for %s and option %s, stat=%d",
876  args[0], args[1], i );
877  return i;
878  }
879  // =-=-=-=-=-=-=-
880  // addition of 'rebalance' as an option to iadmin modresc. not in icat code
881  // due to dependency on resc_mgr, etc.
882  if ( 0 == strcmp( args[1], "rebalance" ) ) {
883  status = 0;
884 
885  // =-=-=-=-=-=-=-
886  // resolve the plugin we wish to rebalance
887  irods::resource_ptr resc;
888  irods::error ret = resc_mgr.resolve( args[0], resc );
889  if ( !ret.ok() ) {
890  irods::log( PASSMSG( "failed to resolve resource", ret ) );
891  status = ret.code();
892  }
893  else {
894  int visibility_status = _check_and_set_rebalance_timestamp_avu_on_resource(rsComm, args[0]);
895  if (visibility_status < 0){
896  return visibility_status;
897  }
898  // =-=-=-=-=-=-=-
899  // call the rebalance operation on the resource
901  ret = resc->call( rsComm, irods::RESOURCE_OP_REBALANCE, obj );
902  if ( !ret.ok() ) {
903  irods::log( PASSMSG( "failed to rebalance resource", ret ) );
904  status = ret.code();
905 
906  }
907  visibility_status = _remove_rebalance_timestamp_avu_from_resource(rsComm, args[0]);
908  if (visibility_status < 0){
909  return visibility_status;
910  }
911 
912  }
913 
914  }
915  else {
916  status = chlModResc(
917  rsComm,
918  generalAdminInp->arg2,
919  generalAdminInp->arg3,
920  generalAdminInp->arg4 );
921 
922  }
923 
924  if ( status == 0 ) {
925  i = applyRuleArg( "acPostProcForModifyResource", args, argc, &rei2, NO_SAVE_REI );
926  if ( i < 0 ) {
927  if ( rei2.status < 0 ) {
928  i = rei2.status;
929  }
931  "rsGeneralAdmin: acPostProcForModifyResource error for %s and option %s, stat=%d",
932  args[0], args[1], i );
933  return i;
934  }
935  }
936  if ( status != 0 ) {
937  chlRollback( rsComm );
938  }
939  return status;
940  }
941  }
942  if ( strcmp( generalAdminInp->arg0, "rm" ) == 0 ) {
943  if ( strcmp( generalAdminInp->arg1, "user" ) == 0 ) {
944  /* run the acDeleteUser rule */
945  const char *args[2];
946  memset( ( char* )&rei, 0, sizeof( rei ) );
947  rei.rsComm = rsComm;
948  userInfo_t userInfo;
949  memset( &userInfo, 0, sizeof( userInfo ) );
950  snprintf( userInfo.userName, sizeof( userInfo.userName ), "%s", generalAdminInp->arg2 );
951  snprintf( userInfo.rodsZone, sizeof( userInfo.rodsZone ), "%s", generalAdminInp->arg3 );
952  userInfo_t userInfoRei = userInfo;
953  char userName[NAME_LEN];
954  char zoneName[NAME_LEN];
955  status = parseUserName( userInfo.userName, userName, zoneName );
956  if ( status != 0 ) {
957  chlRollback( rsComm );
958  return status;
959  }
960  if ( strcmp( zoneName, "" ) != 0 ) {
961  snprintf( userInfoRei.rodsZone, sizeof( userInfoRei.rodsZone ), "%s", zoneName );
962  // =-=-=-=-=-=-=-
963  // JMC :: while correct, much of the code assumes that the user name
964  // has the zone name appended. this will need to be part of
965  // a full audit of the use of userName and zoneName
966  // strncpy( userInfoRei.userName, userName, NAME_LEN );
967  }
968 
969  rei.uoio = &userInfoRei;
970  rei.uoic = &rsComm->clientUser;
971  rei.uoip = &rsComm->proxyUser;
972  status = applyRuleArg( "acDeleteUser", args, 0, &rei, SAVE_REI );
973  if ( status != 0 ) {
974  chlRollback( rsComm );
975  }
976  return status;
977  }
978  if ( strcmp( generalAdminInp->arg1, "dir" ) == 0 ) {
979  memset( ( char* )&collInfo, 0, sizeof( collInfo ) );
980  snprintf( collInfo.collName, sizeof( collInfo.collName ), "%s", generalAdminInp->arg2 );
981  if ( collInfo.collName[sizeof( collInfo.collName ) - 1] ) {
983  }
984  status = chlDelColl( rsComm, &collInfo );
985  if ( status != 0 ) {
986  chlRollback( rsComm );
987  }
988  return status;
989  }
990  if ( strcmp( generalAdminInp->arg1, "resource" ) == 0 ) {
991 
992  std::string resc_name = "";
993 
994  // =-=-=-=-=-=-=-
995  // JMC 04.11.2012 :: add a dry run option to idamin rmresc
996  // :: basically run chlDelResc then run a rollback immediately after
997  if ( strcmp( generalAdminInp->arg3, "--dryrun" ) == 0 ) {
998 
999  if ( strlen( generalAdminInp->arg2 ) >= NAME_LEN ) { // resource name
1000  return SYS_INVALID_INPUT_PARAM;
1001  }
1002 
1003  resc_name = generalAdminInp->arg2;
1004 
1005  rodsLog( LOG_STATUS, "Executing a dryrun of removal of resource [%s]", generalAdminInp->arg2 );
1006 
1007  status = chlDelResc( rsComm, resc_name, 1 );
1008  if ( 0 == status ) {
1009  rodsLog( LOG_STATUS, "DRYRUN REMOVING RESOURCE [%s] :: SUCCESS", generalAdminInp->arg2 );
1010  }
1011  else {
1012  rodsLog( LOG_STATUS, "DRYRUN REMOVING RESOURCE [%s] :: FAILURE", generalAdminInp->arg2 );
1013  }
1014 
1015  return status;
1016  } // if dryrun
1017  // =-=-=-=-=-=-=-
1018 
1019  if ( strlen( generalAdminInp->arg2 ) >= NAME_LEN ) { // resource name
1020  return SYS_INVALID_INPUT_PARAM;
1021  }
1022 
1023  resc_name = generalAdminInp->arg2;
1024 
1025  args[0] = resc_name.c_str();
1026  argc = 1;
1027  i = applyRuleArg( "acPreProcForDeleteResource", args, argc, &rei2, NO_SAVE_REI );
1028  if ( i < 0 ) {
1029  if ( rei2.status < 0 ) {
1030  i = rei2.status;
1031  }
1032  rodsLog( LOG_ERROR,
1033  "rsGeneralAdmin: acPreProcForDeleteResource error for %s, stat=%d",
1034  resc_name.c_str(), i );
1035  return i;
1036  }
1037 
1038  status = chlDelResc( rsComm, resc_name );
1039  if ( status == 0 ) {
1040  i = applyRuleArg( "acPostProcForDeleteResource", args, argc, &rei2, NO_SAVE_REI );
1041  if ( i < 0 ) {
1042  if ( rei2.status < 0 ) {
1043  i = rei2.status;
1044  }
1045  rodsLog( LOG_ERROR,
1046  "rsGeneralAdmin: acPostProcForDeleteResource error for %s, stat=%d",
1047  resc_name.c_str(), i );
1048  return i;
1049  }
1050  }
1051 
1052  if ( status != 0 ) {
1053  chlRollback( rsComm );
1054  }
1055  return status;
1056  }
1057 
1058  /* remove a child resource from the specified parent resource */
1059  if ( strcmp( generalAdminInp->arg1, "childfromresc" ) == 0 ) {
1060  return _removeChildFromResource( generalAdminInp, rsComm );
1061  }
1062 
1063  if ( strcmp( generalAdminInp->arg1, "zone" ) == 0 ) {
1064  status = chlDelZone( rsComm, generalAdminInp->arg2 );
1065  if ( status == 0 ) {
1066  memset( ( char* )&collInfo, 0, sizeof( collInfo ) );
1067  snprintf( collInfo.collName, sizeof( collInfo.collName ), "/%s", generalAdminInp->arg2 );
1068  status = chlDelCollByAdmin( rsComm, &collInfo );
1069  }
1070  if ( status == 0 ) {
1071  status = chlCommit( rsComm );
1072  }
1073  return status;
1074  }
1075  if ( strcmp( generalAdminInp->arg1, "token" ) == 0 ) {
1076 
1077  args[0] = generalAdminInp->arg2;
1078  args[1] = generalAdminInp->arg3;
1079  argc = 2;
1080  i = applyRuleArg( "acPreProcForDeleteToken", args, argc, &rei2, NO_SAVE_REI );
1081  if ( i < 0 ) {
1082  if ( rei2.status < 0 ) {
1083  i = rei2.status;
1084  }
1085  rodsLog( LOG_ERROR,
1086  "rsGeneralAdmin:acPreProcForDeleteToken error for %s.%s,stat=%d",
1087  args[0], args[1], i );
1088  return i;
1089  }
1090 
1091  status = chlDelToken( rsComm, generalAdminInp->arg2,
1092  generalAdminInp->arg3 );
1093 
1094  if ( status == 0 ) {
1095  i = applyRuleArg( "acPostProcForDeleteToken", args, argc, &rei2, NO_SAVE_REI );
1096  if ( i < 0 ) {
1097  if ( rei2.status < 0 ) {
1098  i = rei2.status;
1099  }
1100  rodsLog( LOG_ERROR,
1101  "rsGeneralAdmin: acPostProcForDeleteToken error for %s.%s, stat=%d",
1102  args[0], args[1], i );
1103  return i;
1104  }
1105  }
1106 
1107  if ( status != 0 ) {
1108  chlRollback( rsComm );
1109  }
1110  return status;
1111  }
1112  if ( strcmp( generalAdminInp->arg1, "unusedAVUs" ) == 0 ) {
1113  status = chlDelUnusedAVUs( rsComm );
1114  return status;
1115  }
1116  if ( strcmp( generalAdminInp->arg1, "specificQuery" ) == 0 ) {
1117  status = chlDelSpecificQuery( rsComm, generalAdminInp->arg2 );
1118  return status;
1119  }
1120  }
1121  if ( strcmp( generalAdminInp->arg0, "calculate-usage" ) == 0 ) {
1122  status = chlCalcUsageAndQuota( rsComm );
1123  return status;
1124  }
1125  if ( strcmp( generalAdminInp->arg0, "set-quota" ) == 0 ) {
1126  status = chlSetQuota( rsComm,
1127  generalAdminInp->arg1,
1128  generalAdminInp->arg2,
1129  generalAdminInp->arg3,
1130  generalAdminInp->arg4 );
1131 
1132  return status;
1133  }
1134 
1135  if ( strcmp( generalAdminInp->arg0, "lt" ) == 0 ) {
1137  if ( strcmp( generalAdminInp->arg1, "resc_type" ) == 0 ) {
1138  status = _listRescTypes( rsComm );
1139  }
1140  return status;
1141  }
1142 
1143  return CAT_INVALID_ARGUMENT;
1144 }
rodsLog
void rodsLog(int level, const char *formatStr,...)
Definition: rodsLog.cpp:86
chlDelCollByAdmin
int chlDelCollByAdmin(rsComm_t *rsComm, collInfo_t *collInfo)
Definition: icatHighLevelRoutines.cpp:1774
irods::resource_manager::get_hier_to_root_for_resc
error get_hier_to_root_for_resc(const std::string &, std::string &)
Definition: irods_resource_manager.cpp:434
NULL
#define NULL
Definition: rodsDef.h:70
irods::RESOURCE_CLASS
const std::string RESOURCE_CLASS("resource_property_class")
irods::unit
std::tuple<> unit
Definition: irods_re_plugin.hpp:736
irods::at_scope_exit
Definition: irods_at_scope_exit.hpp:10
irods::RESOURCE_LOCATION
const std::string RESOURCE_LOCATION("resource_property_location")
COL_R_RESC_NAME
#define COL_R_RESC_NAME
Definition: rodsGenQuery.h:144
rsComm_t
Definition: rcConnect.h:145
irods_children_parser.hpp
irods.pyparsing.empty
empty
Definition: pyparsing.py:3430
irods::CFG_SERVICE_ROLE_CONSUMER
const std::string CFG_SERVICE_ROLE_CONSUMER("consumer")
rodsServerHost::localFlag
int localFlag
Definition: rodsConnect.h:68
SYS_SERVICE_ROLE_NOT_SUPPORTED
@ SYS_SERVICE_ROLE_NOT_SUPPORTED
Definition: rodsErrorTable.h:217
irods::RESOURCE_NAME
const std::string RESOURCE_NAME("resource_property_name")
irods::RESOURCE_CLASS_CACHE
const std::string RESOURCE_CLASS_CACHE("cache")
generalAdminInp_t
Definition: generalAdmin.h:6
UNMATCHED_KEY_OR_INDEX
@ UNMATCHED_KEY_OR_INDEX
Definition: rodsErrorTable.h:244
rodsServerHost::conn
rcComm_t * conn
Definition: rodsConnect.h:64
userInfo_t
Definition: rodsUser.h:65
LOG_STATUS
#define LOG_STATUS
Definition: rodsLog.h:34
userInfo_t::userName
char userName[64]
Definition: rodsUser.h:66
irods::plugin_name_generator
Definition: irods_plugin_name_generator.hpp:15
irods::EMPTY_RESC_PATH
const std::string EMPTY_RESC_PATH("EMPTY_RESC_PATH")
_addResource
int _addResource(generalAdminInp_t *_generalAdminInp, ruleExecInfo_t &_rei2, rsComm_t *_rsComm)
Definition: rsGeneralAdmin.cpp:427
irods::plugin_name_generator::exists
bool exists(const std::string &_base_name, const std::string &_dir_name)
Definition: irods_plugin_name_generator.cpp:68
irods_file_object.hpp
RuleExecInfo::status
int status
Definition: irods_re_structs.hpp:19
PASS
#define PASS(prev_error_)
Definition: irods_error.hpp:118
generalAdminInp_t::arg6
const char * arg6
Definition: generalAdmin.h:13
irods::EMPTY_RESC_HOST
const std::string EMPTY_RESC_HOST("EMPTY_RESC_HOST")
irods::resource_ptr
boost::shared_ptr< resource > resource_ptr
Definition: irods_resource_types.hpp:11
NO_SAVE_REI
#define NO_SAVE_REI
Definition: rodsDef.h:103
rcComm_t::rError
rError_t * rError
Definition: rcConnect.h:106
irods::plugin_name_generator::plugin_list_t
std::vector< std::string > plugin_list_t
Definition: irods_plugin_name_generator.hpp:19
COL_META_RESC_ATTR_VALUE
#define COL_META_RESC_ATTR_VALUE
Definition: rodsGenQuery.h:229
GenQueryInp
Definition: rodsGenQuery.h:24
generalAdmin.h
irods::hierarchy_parser
Definition: irods_hierarchy_parser.hpp:14
chlDelChildResc
int chlDelChildResc(rsComm_t *rsComm, std::map< std::string, std::string > &_resc_input)
Definition: icatHighLevelRoutines.cpp:923
rcGeneralAdmin
int rcGeneralAdmin(rcComm_t *conn, generalAdminInp_t *generalAdminInp)
Definition: rcGeneralAdmin.cpp:49
irods::RESOURCE_CONTEXT
const std::string RESOURCE_CONTEXT("resource_property_context")
irods::RESOURCE_CHILDREN
const std::string RESOURCE_CHILDREN("resource_property_children")
chlSetQuota
int chlSetQuota(rsComm_t *rsComm, const char *type, const char *name, const char *rescName, const char *limit)
Definition: icatHighLevelRoutines.cpp:3468
LOCAL_HOST
#define LOCAL_HOST
Definition: rodsConnect.h:44
COL_META_RESC_ATTR_UNITS
#define COL_META_RESC_ATTR_UNITS
Definition: rodsGenQuery.h:230
irods::RESOURCE_PATH
const std::string RESOURCE_PATH("resource_property_path")
chlDelToken
int chlDelToken(rsComm_t *rsComm, const char *nameSpace, const char *Name)
Definition: icatHighLevelRoutines.cpp:3135
chlModZoneCollAcl
int chlModZoneCollAcl(rsComm_t *rsComm, const char *accessLevel, const char *userName, const char *pathName)
Definition: icatHighLevelRoutines.cpp:1520
chlRenameColl
int chlRenameColl(rsComm_t *rsComm, const char *oldName, const char *newName)
Definition: icatHighLevelRoutines.cpp:1467
generalAdminInp_t::arg4
const char * arg4
Definition: generalAdmin.h:11
PASSMSG
#define PASSMSG(message_, prev_error_)
Definition: irods_error.hpp:119
chlModResc
int chlModResc(rsComm_t *rsComm, const char *rescName, const char *option, const char *optionValue)
Definition: icatHighLevelRoutines.cpp:2223
deploy_schemas_locally.parser
parser
Definition: deploy_schemas_locally.py:59
chlCommit
int chlCommit(rsComm_t *rsComm)
Definition: icatHighLevelRoutines.cpp:1090
addInxVal
int addInxVal(inxValPair_t *inxValPair, int inx, const char *value)
Definition: rcMisc.cpp:921
LOG_ERROR
#define LOG_ERROR
Definition: rodsLog.h:43
_check_rebalance_timestamp_avu_on_resource
int _check_rebalance_timestamp_avu_on_resource(rsComm_t *_rsComm, const std::string &_resource_name)
Definition: rsGeneralAdmin.cpp:40
generalAdminInp_t::arg0
const char * arg0
Definition: generalAdmin.h:7
SYS_INVALID_INPUT_PARAM
@ SYS_INVALID_INPUT_PARAM
Definition: rodsErrorTable.h:195
rodsConnect.h
irods::string_tokenize
void string_tokenize(const std::string &, const std::string &, std::vector< std::string > &)
Definition: irods_string_tokenize.cpp:9
CollInfo
Definition: objInfo.h:177
rsModAVUMetadata.hpp
rsGeneralAdmin.hpp
CAT_RESOURCE_NAME_LENGTH_EXCEEDED
@ CAT_RESOURCE_NAME_LENGTH_EXCEEDED
Definition: rodsErrorTable.h:467
chlRegColl
int chlRegColl(rsComm_t *rsComm, collInfo_t *collInfo)
Definition: icatHighLevelRoutines.cpp:1246
chlDelUnusedAVUs
int chlDelUnusedAVUs(rsComm_t *rsComm)
Definition: icatHighLevelRoutines.cpp:3583
irods::experimental::filesystem::client::end
auto end(const collection_iterator &) noexcept -> const collection_iterator
Definition: collection_iterator.hpp:88
generalAdminInp_t::arg3
const char * arg3
Definition: generalAdmin.h:10
chlRegResc
int chlRegResc(rsComm_t *rsComm, std::map< std::string, std::string > &_resc_input)
Definition: icatHighLevelRoutines.cpp:873
generalAdminInp_t::arg7
const char * arg7
Definition: generalAdmin.h:14
SUCCESS
#define SUCCESS()
Definition: irods_error.hpp:121
irods_string_tokenize.hpp
irods::experimental::filesystem::client::begin
auto begin(collection_iterator _iter) noexcept -> collection_iterator
Definition: collection_iterator.hpp:83
irods::resolve_plugin_path
static error resolve_plugin_path(const std::string &_type, std::string &_path)
Definition: irods_load_plugin.hpp:33
rsComm_t::rError
rError_t rError
Definition: rcConnect.h:158
irods::error::code
long long code() const
Definition: irods_error.cpp:194
generalAdminInp_t::arg5
const char * arg5
Definition: generalAdmin.h:12
chlRegToken
int chlRegToken(rsComm_t *rsComm, const char *nameSpace, const char *name, const char *value, const char *value2, const char *value3, const char *comment)
Definition: icatHighLevelRoutines.cpp:3069
SAVE_REI
#define SAVE_REI
Definition: rodsDef.h:104
MAX_PATH_ALLOWED
#define MAX_PATH_ALLOWED
Definition: rodsDef.h:58
getSqlResultByInx
sqlResult_t * getSqlResultByInx(genQueryOut_t *genQueryOut, int attriInx)
Definition: rcMisc.cpp:1387
irods_resource_constants.hpp
LOG_DEBUG
#define LOG_DEBUG
Definition: rodsLog.h:23
rsComm_t::proxyUser
userInfo_t proxyUser
Definition: rcConnect.h:152
chlDelZone
int chlDelZone(rsComm_t *rsComm, const char *zoneName)
Definition: icatHighLevelRoutines.cpp:1628
_removeChildFromResource
int _removeChildFromResource(generalAdminInp_t *_generalAdminInp, rsComm_t *_rsComm)
Definition: rsGeneralAdmin.cpp:398
pid_age.pid
pid
Definition: pid_age.py:12
irods::RESOURCE_TYPE
const std::string RESOURCE_TYPE("resource_property_type")
generalAdminInp_t::arg1
const char * arg1
Definition: generalAdmin.h:8
irods_load_plugin.hpp
irods::CFG_SERVICE_ROLE_PROVIDER
const std::string CFG_SERVICE_ROLE_PROVIDER("provider")
applyRuleArg
int applyRuleArg(const char *action, const char *args[20], int argc, ruleExecInfo_t *rei, int reiSaveFlag)
Definition: irods_re_structs.cpp:95
chlRegZone
int chlRegZone(rsComm_t *rsComm, const char *zoneName, const char *zoneType, const char *zoneConnInfo, const char *zoneComment)
Definition: icatHighLevelRoutines.cpp:1352
SYS_RESC_DOES_NOT_EXIST
@ SYS_RESC_DOES_NOT_EXIST
Definition: rodsErrorTable.h:145
MAX_NAME_LEN
#define MAX_NAME_LEN
Definition: rodsDef.h:61
chlCalcUsageAndQuota
int chlCalcUsageAndQuota(rsComm_t *rsComm)
Definition: icatHighLevelRoutines.cpp:3423
chlRollback
int chlRollback(rsComm_t *rsComm)
Definition: icatHighLevelRoutines.cpp:1039
MAX_NUM_OF_ARGS_IN_ACTION
#define MAX_NUM_OF_ARGS_IN_ACTION
Definition: irods_re_structs.hpp:13
chlDelColl
int chlDelColl(rsComm_t *rsComm, collInfo_t *collInfo)
Definition: icatHighLevelRoutines.cpp:1824
irods::children_parser
Definition: irods_children_parser.hpp:15
irods::resource_manager::resolve
error resolve(std::string, resource_ptr &)
Definition: irods_resource_manager.cpp:51
addInxIval
int addInxIval(inxIvalPair_t *inxIvalPair, int inx, int value)
Definition: rcMisc.cpp:883
SYS_NO_RCAT_SERVER_ERR
@ SYS_NO_RCAT_SERVER_ERR
Definition: rodsErrorTable.h:110
GenQueryOut
Definition: rodsGenQuery.h:67
addRErrorMsg
int addRErrorMsg(rError_t *myError, int status, const char *msg)
Definition: rcMisc.cpp:121
chlModZone
int chlModZone(rsComm_t *rsComm, const char *zoneName, const char *option, const char *optionValue)
Definition: icatHighLevelRoutines.cpp:1411
irods::RESOURCE_ZONE
const std::string RESOURCE_ZONE("resource_property_zone")
irods::hierarchy_parser::set_string
error set_string(const std::string &_resc_hier)
Definition: irods_hierarchy_parser.cpp:36
get_irods_version.value
dictionary value
Definition: get_irods_version.py:27
irods.pypyodbc.status
status
Definition: pypyodbc.py:467
STDOUT_STATUS
static const int STDOUT_STATUS
Definition: rcMisc.h:327
userInfo_t::rodsZone
char rodsZone[64]
Definition: rodsUser.h:67
CAT_INVALID_RESOURCE
@ CAT_INVALID_RESOURCE
Definition: rodsErrorTable.h:446
irods::log
void log(const error &)
Definition: irods_log.cpp:13
rsModAVUMetadata
int rsModAVUMetadata(rsComm_t *rsComm, modAVUMetadataInp_t *modAVUMetadataInp)
Definition: rsModAVUMetadata.cpp:13
generalAdminInp_t::arg2
const char * arg2
Definition: generalAdmin.h:9
LOG_NOTICE
#define LOG_NOTICE
Definition: rodsLog.h:33
modAVUMetadataInp_t
Definition: modAVUMetadata.h:6
rsComm_t::clientUser
userInfo_t clientUser
Definition: rcConnect.h:153
resc_mgr
irods::resource_manager resc_mgr
Definition: irods_resource_manager.cpp:31
irods::error
Definition: irods_error.hpp:23
irods::plugin_name_generator::list_plugins
error list_plugins(const std::string &_dir_name, plugin_list_t &_list)
Definition: irods_plugin_name_generator.cpp:87
miscServerFunct.hpp
_set_rebalance_timestamp_avu_on_resource
int _set_rebalance_timestamp_avu_on_resource(rsComm_t *_rsComm, const std::string &_resource_name)
Definition: rsGeneralAdmin.cpp:86
userInfo_t::userType
char userType[64]
Definition: rodsUser.h:68
HIERARCHY_ERROR
@ HIERARCHY_ERROR
Definition: rodsErrorTable.h:752
getAndConnRcatHost
int getAndConnRcatHost(rsComm_t *rsComm, int rcatType, const char *rcatZoneHint, rodsServerHost_t **rodsServerHost)
Definition: rodsConnect.cpp:26
SqlResult::value
char * value
Definition: rodsGenQuery.h:64
irods_hierarchy_parser.hpp
irods_plugin_name_generator.hpp
MASTER_RCAT
#define MASTER_RCAT
Definition: rodsDef.h:85
chlModRescDataPaths
int chlModRescDataPaths(rsComm_t *rsComm, const char *rescName, const char *oldPath, const char *newPath, const char *userName)
Definition: icatHighLevelRoutines.cpp:2279
chlDelSpecificQuery
int chlDelSpecificQuery(rsComm_t *rsComm, const char *sqlOrAlias)
Definition: icatHighLevelRoutines.cpp:4127
get_catalog_service_role
irods::error get_catalog_service_role(std::string &_role)
Definition: miscServerFunct.cpp:3153
irods::file_object
Definition: irods_file_object.hpp:19
rodsServerHost
Definition: rodsConnect.h:62
SqlResult
Definition: rodsGenQuery.h:61
REBALANCE_ALREADY_ACTIVE_ON_RESOURCE
@ REBALANCE_ALREADY_ACTIVE_ON_RESOURCE
Definition: rodsErrorTable.h:778
irods::file_object_ptr
boost::shared_ptr< file_object > file_object_ptr
Definition: irods_file_object.hpp:145
irods::hierarchy_parser::num_levels
error num_levels(int &levels) const
Definition: irods_hierarchy_parser.cpp:185
RuleExecInfo
Definition: irods_re_structs.hpp:18
irods_resource_manager.hpp
irods::resource_manager
Definition: irods_resource_manager.hpp:30
chlDelResc
int chlDelResc(rsComm_t *rsComm, const std::string &_resc_name, int _dryrun=0)
Definition: icatHighLevelRoutines.cpp:977
irods_at_scope_exit.hpp
CHILD_NOT_FOUND
@ CHILD_NOT_FOUND
Definition: rodsErrorTable.h:753
icatHighLevelRoutines.hpp
replErrorStack
int replErrorStack(rError_t *srcRError, rError_t *destRError)
Definition: rcMisc.cpp:152
CAT_INVALID_ARGUMENT
@ CAT_INVALID_ARGUMENT
Definition: rodsErrorTable.h:431
chlAddSpecificQuery
int chlAddSpecificQuery(rsComm_t *rsComm, const char *alias, const char *sql)
Definition: icatHighLevelRoutines.cpp:4076
irods::RESOURCE_PARENT
const std::string RESOURCE_PARENT("resource_property_parent")
_remove_rebalance_timestamp_avu_from_resource
int _remove_rebalance_timestamp_avu_from_resource(rsComm_t *_rsComm, const std::string &_resource_name)
Definition: rsGeneralAdmin.cpp:139
chlModGroup
int chlModGroup(rsComm_t *rsComm, const char *groupName, const char *option, const char *userName, const char *userZone)
Definition: icatHighLevelRoutines.cpp:2164
rsGenQuery.hpp
userInfo_t::authInfo
authInfo_t authInfo
Definition: rodsUser.h:70
irods::RESOURCE_OP_REBALANCE
const std::string RESOURCE_OP_REBALANCE("resource_rebalance")
rstrcpy
char * rstrcpy(char *dest, const char *src, int maxLen)
Definition: stringOpr.cpp:51
irods::PLUGIN_TYPE_RESOURCE
const std::string PLUGIN_TYPE_RESOURCE("resources")
freeGenQueryOut
int freeGenQueryOut(genQueryOut_t **genQueryOut)
Definition: rcMisc.cpp:1133
NAME_LEN
#define NAME_LEN
Definition: rodsDef.h:55
COL_META_RESC_ATTR_NAME
#define COL_META_RESC_ATTR_NAME
Definition: rodsGenQuery.h:228
irods::error::ok
bool ok()
Definition: irods_error.cpp:258
chlRegCollByAdmin
int chlRegCollByAdmin(rsComm_t *rsComm, collInfo_t *collInfo)
Definition: icatHighLevelRoutines.cpp:1190
parseUserName
int parseUserName(const char *fullUserNameIn, char *userName, char *userZone)
Definition: rcMisc.cpp:204
_listRescTypes
int _listRescTypes(rsComm_t *_rsComm)
Definition: rsGeneralAdmin.cpp:556
rsGeneralAdmin
int rsGeneralAdmin(rsComm_t *rsComm, generalAdminInp_t *generalAdminInp)
Definition: rsGeneralAdmin.cpp:183
clearGenQueryInp
void clearGenQueryInp(void *voidInp)
Definition: rcMisc.cpp:1118
rsGenQuery
int rsGenQuery(rsComm_t *rsComm, genQueryInp_t *genQueryInp, genQueryOut_t **genQueryOut)
Definition: rsGenQuery.cpp:604
CHILD_HAS_PARENT
@ CHILD_HAS_PARENT
Definition: rodsErrorTable.h:761
chlModUser
int chlModUser(rsComm_t *rsComm, const char *userName, const char *option, const char *newValue)
Definition: icatHighLevelRoutines.cpp:2106
_addChildToResource
int _addChildToResource(generalAdminInp_t *_generalAdminInp, rsComm_t *_rsComm)
Definition: rsGeneralAdmin.cpp:231
authInfo_t::authStr
char authStr[64]
Definition: rodsUser.h:46
_rsGeneralAdmin
int _rsGeneralAdmin(rsComm_t *rsComm, generalAdminInp_t *generalAdminInp)
Definition: rsGeneralAdmin.cpp:592
_check_and_set_rebalance_timestamp_avu_on_resource
int _check_and_set_rebalance_timestamp_avu_on_resource(rsComm_t *_rsComm, const std::string &_resource_name)
Definition: rsGeneralAdmin.cpp:124
chlAddChildResc
int chlAddChildResc(rsComm_t *rsComm, std::map< std::string, std::string > &_resc_input)
Definition: icatHighLevelRoutines.cpp:819