[FOLIO-1192] folio-ansible: Empty loan_users list. Zero active patron users in mod-circulation-data role Created: 11/Apr/18  Updated: 12/Nov/18  Resolved: 11/Apr/18

Status: Closed
Project: FOLIO
Components: None
Affects versions: None
Fix versions: None

Type: Task Priority: P2
Reporter: John Malconian Assignee: Wayne Schneider
Resolution: Done Votes: 0
Labels: ci, sprint36
Remaining Estimate: Not Specified
Time Spent: 2 hours, 30 minutes
Original estimate: Not Specified

Attachments: PNG File random.png    
Sprint:

 Description   

I've come across this error a couple of time now:

TASK [folio-ansible/roles/mod-circulation-data : Load loans] *******************
fatal: [10.36.1.77]: FAILED! =>

{"failed": true, "msg": "the field 'args' has an invalid value, which appears to include a variable that is undefined. The error was: list object has no element 0\n\nThe error appears to have been in '/home/jenkins/workspace/Automation/folio-testing-backend01/CI/ansible/folio-ansible/roles/mod-circulation-data/tasks/main.yml': line 96, column 3, but may\nbe elsewhere in the file depending on the exact syntax problem.\n\nThe offending line appears to be:\n\n# 422 (or 500?) error means the data are already there\n- name: Load loans\n ^ here\n"}

 Comments   
Comment by John Malconian [ 11/Apr/18 ]

It appears there are no users designated as 'active':

[malc@ip-10-36-20-124 scripts]$ curl -H 'x-okapi-tenant: diku' -H 'x-okapi-token: eyJhbGciOiJIUzUxMiJ9.yJzdWIiOiJkaWt1X2FkbWluIiwidXNlcl9pZCI6IjFhZDczN2IwLWQ4NDctMTFlNi1iZjI2LWNlYzBjOTMyY2UwMSIsInRlbmFudCI6ImRpa3UifQ.tmPkMJ_xhcy_03q2od8xAsuNAeCATPUBFQd2eMr6Y15DJc72wVyFgTgLvVzoVc2qbjV_5_sBQLLG-PQc0zYDpg' "http://10.36.1.77:9130/users?query=active%3D%22true%22%20and%20type%3D%3Dpatron%20sortby%20personal.lastName%20personal.firstName&limit=6"

{
"users" : [ ],
"totalRecords" : 0,
"resultInfo" :

{ "totalRecords" : 0, "facets" : [ ], "diagnostics" : [ ] }

}

200 users have been loaded:

[malc@ip-10-36-20-124 scripts]$ curl -H 'x-okapi-tenant: diku' -H 'x-okapi-token: eyJhbGciOiJIUzUxMiJ9.eyJzdWIiOiJkaWt1X2FkbWluIiwidXNlcl9pZCI6IjFhZDczN2IwLWQ4NDctMTFlNi1iZjI2LWNlYzBjOTMyY2UwMSIsInRlbmFudCI6ImRpa3UifQ.tmPkMJ_xhcy_03q2od8xAsuNAeCATPUBFQd2eMr6Y15DJc72wVyFgTgLvVzoVc2qbjV_5_sBQLLG-PQc0zYDpg' "http://10.36.1.77:9130/users?query=type%3D%3Dpatron%20sortby%20personal.lastName%20personal.firstName&limit=1"
{
"users" : [ {
"username" : "hal",
"id" : "a69b395a-7987-43ac-97e7-0d394275f1a1",
"barcode" : "762017189809078",
"active" : false,
"type" : "patron",
"patronGroup" : "ba63f86e-a6c2-4ba2-874d-a35903ae1f6d",
"proxyFor" : [ ],
"personal" : {
"lastName" : "Abbott",
"firstName" : "Stacey",
"email" : "haylie@jacobs-walsh-and-wuckert.bs",
"phone" : "399.680.8263",
"mobilePhone" : "133.523.8475 x25924",
"dateOfBirth" : "1973-08-05T00:00:00.000+0000",
"addresses" : [

{ "countryId" : "US", "addressLine1" : "63442 Luettgen Shoals Suite 545", "city" : "Lomita", "region" : "VA", "postalCode" : "23662", "addressTypeId" : "5b9c1cf8-9014-4e25-b474-fad2f6bb080d", "primaryAddress" : true }

],
"preferredContactTypeId" : "003"
},
"enrollmentDate" : "1970-05-05T00:00:00.000+0000",
"expirationDate" : "1990-12-17T00:00:00.000+0000",
"createdDate" : "2018-04-11T01:56:34.439+0000",
"updatedDate" : "2018-04-11T01:56:34.439+0000",
"metadata" :

{ "createdDate" : "2018-04-11T01:56:34.431+0000", "createdByUserId" : "1ad737b0-d847-11e6-bf26-cec0c932ce01", "updatedDate" : "2018-04-11T01:56:34.431+0000", "updatedByUserId" : "1ad737b0-d847-11e6-bf26-cec0c932ce01" }

} ],
"totalRecords" : 200,
"resultInfo" :

{ "totalRecords" : 200, "facets" : [ ], "diagnostics" : [ ] }
Comment by John Malconian [ 11/Apr/18 ]

From gen-folio-users:

active => (rand(1) > 0.3 ? JSON::true : JSON::false),

So it appears the number active users generated is random though I'm not quite sure what ' > 0.3' does here.

Comment by John Malconian [ 11/Apr/18 ]

I'm guessing > 0.3 really means NOT zero if the range for rand is 0-1. it doesn't seem that rand is working properly or at least is not very random.

Comment by John Malconian [ 11/Apr/18 ]

It appears the error is caused by a recent commit to mod-users.

https://github.com/folio-org/mod-users/commit/15a5ecfaadb6000d66553d58bd0f09b1282e1cf8

Comment by Zak Burke [ 11/Apr/18 ]

Comment by Wayne Schneider [ 11/Apr/18 ]

John Malconian is right, the issue was that mod-users now magically makes users who have expired "inactive" – which in this case was all of them. I changed the script to make users expire a random number of days (up to 2 years) after the date the script is run.

Generated at Thu Feb 08 23:11:30 UTC 2024 using Jira 1001.0.0-SNAPSHOT#100246-sha1:7a5c50119eb0633d306e14180817ddef5e80c75d.