Your browser was unable to load all of the resources. They may have been blocked by your firewall, proxy or browser configuration.
Press Ctrl+F5 or Ctrl+Shift+R to have your browser try again.

Can you authorize unauthorized agents in script #4347

tomz ·

I'm searching through the javadocs and I can't seem to find something that allows me to authorize a given unauthorized node using groovy scripting. Is this allowed? If not, is there a REST equivalent?

Thanks,
Tom Z.

  • replies 3
  • views 1114
  • stars 1
robinshen ADMIN ·

This can be done by running below groovy script:

groovy:
import com.pmease.quickbuild.model.Token;
import com.pmease.quickbuild.entitymanager.TokenManager;
import java.util.UUID;

Token token = new Token();
token.setIp(ip);
token.setPort(port);
token.setHostName("<Unknown>");
token.setValue(UUID.randomUUID().toString());
TokenManager.instance.save(token);
tomz ·

This code has weird behavior. If I attempt to use those hosts as GridNode objects later in the groovy script, they throw errors, and the Active and Unauthorized nodes both contain the same object names!

  1. The error is grid.getNode(hostName) returns null, even though the host exists in the active node list. Does authorizing nodes with the above script require me to wait until they are active?
  2. What's the proper way to test if the authorized node is "active"?
robinshen ADMIN ·

It may take a while for node to become active, just polling grid.getNode(hostname) to be non-null and continue with your logic.