login Signup

How to parse the cleanupRepository response

The other day I manually ran the cleanupRepository on one of my servers and this deleted many artifacts that are not supposed to be deleted, it did show me which directories were deleted though.
Now I am trying to ensure that the procedure I am writing logs the directories deleted, but when calling it via the api there isn't a response.

Here is what I have tried.

 print "Starting Repository cleanup\n";
 $resp = $cmdr->getRepositories();
 print "resp: " . $resp . "\n";
 $resp2 = $cmdr->cleanupRepository("D:\\Electric Cloud\\repository-data");
 print "resp2: " . $resp2 . "\n";

This is what is in the log file of the procedure

 Starting Repository cleanup
 resp: ElectricCommander::ResponseHandler::XML=HASH(0x28812f8)


In the API documentation it says that it returns a list of deleted directories, but I am not seeing anything that is being returned.

avatar image By aorr 17 asked Jan 31 at 02:29 PM
more ▼
(comments are locked)
avatar image aorr Jan 31 at 04:54 PM

I put the getRepositories call just to show that I am getting a response from one call but not the other. The problem is for cleanupRepository.

10|750 characters needed characters left

1 answer: sort voted first

I'll let someone who's more current on Perl than I am to help you get the Perl syntax right. If it were me, I'd use DSL or Groovy to do this since responses from these are vastly easier to deal with than Perl. For example,



         "repositoryId": "49294ee1-2380-11e8-9b31-0ab31b11084a",
         "repositoryName": "default-original",
         "createTime": "2018-03-09T09:57:32.488Z",
         "description": "Default repository created during installation.",
         "lastModifiedBy": "admin",
         "modifyTime": "2018-03-09T21:50:42.985Z",
         "owner": "admin",
         "propertySheetId": "49299d03-2380-11e8-9b31-0ab31b11084a",
         "repositoryDisabled": "1",
         "repositoryIndex": "1",
         "url": "",
         "zoneName": "default"
         "repositoryId": "0f5d5e8f-23da-11e8-8fcd-0ab31b11084a",
         "repositoryName": "default",
         "createTime": "2018-03-09T20:40:10.235Z",
         "description": "Created by the installer.",
         "lastModifiedBy": "admin",
         "modifyTime": "2019-01-04T02:51:16.615Z",
         "owner": "admin",
         "propertySheetId": "0f5d85a1-23da-11e8-8fcd-0ab31b11084a",
         "repositoryDisabled": "0",
         "repositoryIndex": "2",
         "url": "",
         "zoneName": "default"

Accessing fields is super easy:



To run DSL, you can use DSLIDE (https://github.com/electric-cloud/EC-DSLIDE, if not already installed) or through the command line:

 ectool --format json evalDsl --dslFile <filepath>

To use Groovy, see http://docs.electric-cloud.com/eflow_doc/8_5/API/HTML/FlowAPI_Guide_8_5.htm

avatar image By gregm 2k answered Jan 31 at 03:55 PM
more ▼
(comments are locked)
avatar image aorr Jan 31 at 04:57 PM

Thank you for the quick response. I am sorry I was unclear in my question. The getRepositories call was just to show that I was able to get a response from a call just not the cleanupRepositories, which is the problem.

avatar image gregm Jan 31 at 05:45 PM

I see, you were expecting some sort of response from cleanupRepositories(), but none was received. Yes, according to the documentation, http://docs.electric-cloud.com/eflow_doc/8_5/API/HTML/FlowAPI_Guide_8_5.htm#APIartifacts.htm#cleanupRepository, you should have gotten a list of directories that were deleted.

You might try running the ectool command instead to see the structure of the response when there is one.

10|750 characters needed characters left
Your answer
toggle preview:

Up to 8 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.