zhmcclient / zhmccli

A CLI for the IBM Z HMC
Apache License 2.0
9 stars 9 forks source link

"zhmc user create --like ..." fails for non-LDAP or non-MFA users #557

Closed andy-maier closed 8 months ago

andy-maier commented 8 months ago

Examples:

Create User on T224 HMC fails when like user is a non-LDAP user:

$ zhmc --log hmc=debug user create --name zhmc1 --like zaaslparmgr

DEBUG zhmcclient.hmc: Request: POST https://9.114.87.7:6794/api/console/users, headers: {'User-Agent': 'python-zhmcclient/1.13.3', 'Content-type': 'application/json', 'Accept': '*/*', 'X-API-Session': '********'}, content(822 B): '{"type": "standard", "disabled": false, "authentication-type": "local", "password-rule-uri": "/api/console/password-rules/520c0138-4a7e-11e9-8bb3-bdfeb245fc36", "force-password-change": false, "ldap-server-definition-uri": null, "userid-on-ldap-server": null, "session-timeout": 0, "verify-timeout": 15, "idle-timeout": 20, "min-pw-change-time": 0, "max-failed-logins": 3, "disable-delay": 1, "inactivity-timeout": 0, "disruptive-pw-required": true, "disruptive-text-required": false, "allow-remote-access": false, "allow-management-interfaces": true, "max-web-services-api-sessions": 100, "web-services-api-session-idle-timeout": 15, "multi-factor-authentication-required": false, "mfa-types": null, "primary-mfa-server-definition-uri": null, "backup-mfa-server-definition-uri": null, "mfa-policy": null, "name": "zhmc1"}'

DEBUG zhmcclient.hmc: Respons: POST https://9.114.87.7:6794/api/console/users, status: 400, headers: {'Strict-Transport-Security': 'max-age=0', 'X-Frame-Options': 'SAMEORIGIN', 'X-Content-Type-Options': 'nosniff', 'X-XSS-Protection': '1; mode=block', 'Content-Security-Policy': "img-src * data:; frame-ancestors 'self'", 'x-request-id': 'Sx25506478-7980-11ee-88e5-00106f234c71.5ad Rx24', 'Cache-control': 'no-cache', 'x-api-reason-code': '7', 'Content-Type': 'application/json', 'Content-Length': '569', 'Date': 'Sat, 03 Feb 2024 09:15:17 GMT', 'Connection': 'close', 'Server': 'Hardware management console API web server / 2.0'}, content: '{"http-status": 400, "reason": 7, "request-uri": "/api/console/users", "request-method": "POST", "message": "Schema will not accept null in this circumstance.  at line: 1 column: 227 resource: /api/console/users (key=ldap-server-definition-uri)", "request-headers": {"content-length": "822", "host": "9.114.87.7:6794", "connection": "keep-alive", "content-type": "application/json", "x-api-session": "********", "accept-encoding": "gzip, deflate", "user-agent": "python-zhmcclient/1.13.3", "accept": "*/*"}, "request-authenticated-as": "maiera@de.ibm.com"}'

Error: HTTPError: 400,7: Schema will not accept null in this circumstance.  at line: 1 column: 227 resource: /api/console/users (key=ldap-server-definition-uri) [POST /api/console/users]

Also fails when omitting the LDAP related properties but specifying the MFA related properties as null.