Beispiel #1
0
int
rsRuleExecDel( rsComm_t *rsComm, ruleExecDelInp_t *ruleExecDelInp ) {
    rodsServerHost_t *rodsServerHost;
    int status;

    if ( ruleExecDelInp == NULL ) {
        rodsLog( LOG_NOTICE,
                 "rsRuleExecDel error. NULL input" );
        return SYS_INTERNAL_NULL_INPUT_ERR;
    }

    status = getAndConnReHost( rsComm, &rodsServerHost );
    if ( status < 0 ) {
        return status;
    }

    if ( rodsServerHost->localFlag == LOCAL_HOST ) {
        std::string svc_role;
        irods::error ret = get_catalog_service_role(svc_role);
        if(!ret.ok()) {
            irods::log(PASS(ret));
            return ret.code();
        }

        if( irods::CFG_SERVICE_ROLE_PROVIDER == svc_role ) {
            status = _rsRuleExecDel( rsComm, ruleExecDelInp );
        } else if( irods::CFG_SERVICE_ROLE_CONSUMER == svc_role ) {
            rodsLog( LOG_NOTICE,
                     "rsRuleExecDel error. ICAT is not configured on this host" );
            return SYS_NO_RCAT_SERVER_ERR;
        } else {
            rodsLog(
                LOG_ERROR,
                "role not supported [%s]",
                svc_role.c_str() );
            status = SYS_SERVICE_ROLE_NOT_SUPPORTED;
        }
    }
    else {
        status = rcRuleExecDel( rodsServerHost->conn, ruleExecDelInp );
    }
    if ( status < 0 ) {
        rodsLog( LOG_ERROR,
                 "rsRuleExecDel: rcRuleExecDel failed, status = %d",
                 status );
    }
    return status;
}
Beispiel #2
0
int
rmDelayedRule( char *ruleId ) {
    int status;

    ruleExecDelInp_t ruleExecDelInp;

    snprintf( ruleExecDelInp.ruleExecId, sizeof( ruleExecDelInp.ruleExecId ),
              "%s", ruleId );
    status = rcRuleExecDel( Conn, &ruleExecDelInp );

    if ( status == CAT_SUCCESS_BUT_WITH_NO_INFO ) {
        printf( "No rule found with id %s\n", ruleId );
    }
    if ( status < 0 ) {
        printError( Conn, status, "rcRuleExecDel" );
    }
    return status;
}
Beispiel #3
0
int
main(int argc, char **argv)
{
    rcComm_t *conn;
    rodsEnv myRodsEnv;
    rErrMsg_t errMsg;
    int status;
    dataObjInp_t dataObjOpenInp;
    ruleExecDelInp_t ruleExecDelInp;

    if (argc != 2) {
        fprintf(stderr, "Usage: %s rods_dataObj\n",argv[0]);
        exit(1);
    }

    memset (&errMsg, 0, sizeof (rErrMsg_t));

    status = getRodsEnv (&myRodsEnv);

    if (status < 0) {
	fprintf (stderr, "getRodsEnv error, status = %d\n", status);
	exit (1);
    }

    conn = rcConnect (myRodsEnv.rodsHost, myRodsEnv.rodsPort, USER_NAME,
      RODS_ZONE, 0, &errMsg);

    if (conn == NULL) {
        fprintf (stderr, "rcConnect error\n");
        exit (1);
    }

    status = clientLogin(conn);
    if (status != 0) {
        rcDisconnect(conn);
        exit (7);
    }

    /* test rcRuleExecDel call */

    memset (&ruleExecDelInp, 0, sizeof (ruleExecDelInp));
    snprintf (ruleExecDelInp.ruleExecId, NAME_LEN, "%s", argv[1]);

    status = rcRuleExecDel (conn, &ruleExecDelInp);

    if (status < 0) {
        fprintf (stderr, "ruleExecDelInp of %s error. status = %d\n", 
	 argv[1], status);
        rcDisconnect (conn);
        exit (1);
    } else {
        printf ("ruleExecDelInp: status = %d\n", status);
    }


    /* test rcDataObjUnlink call */

    memset (&dataObjOpenInp, 0, sizeof (dataObjOpenInp));

    snprintf (dataObjOpenInp.objPath, MAX_NAME_LEN, "%s/%s",
      myRodsEnv.rodsCwd, argv[1]);

    status = rcDataObjUnlink (conn, &dataObjOpenInp);

    if (status < 0) {
        fprintf (stderr, "rcDataObjUnlink error. status = %d\n", status);
        rcDisconnect (conn);
        exit (1);
    } else {
        printf ("rcDataObjUnlink: status = %d\n", status);
    }


    rcDisconnect (conn);
}