Exported LDIF cannot be used for import - docker-compose

Im trying to create an easily reproducible ldap setup for some testing.
I've been using bitnami's openldap docker container to load an exported ldif file at startup.
However, importing the ldif file fails.
When manually starting the import manually, I receive a [LDAP result code 53 - unwillingToPerform] no global superior knowledge error.
The ldif i'm using was generated with the export command from the apache directory studio client on a system that had the required structure (initially generated by the bitnami container, then extended through the client).
It's unclear to me whether this is an issue with the container, the server or the ldif file. The error would point to missing elements in the ldif, but I'd expect this definition to create all required elements, from top level to bottom.
Docker compose file
version: '3'
services:
ldap:
image: docker.io/bitnami/openldap:2.6
ports:
- '1389:1389'
- '1636:1636'
volumes:
- ldap:/bitnami/openldap
- ./resources/ldap/test2.ldif:/ldifs/test2.ldif
environment:
- LDAP_ADMIN_USERNAME=admin
- LDAP_ADMIN_PASSWORD=admin
- LDAP_CUSTOM_LDIF_DIR=/ldifs-custom
# envvars for generating the base ldap structure, not used when importing ldif
# - LDAP_ROOT=dc=xenit,dc=eu
# - LDAP_USERS=red,blue
# - LDAP_PASSWORDS=red,blue
# - LDAP_USER_DC=alfresco
# - LDAP_GROUP=users
LDIF file
version: 1
dn: dc=xenit,dc=eu
objectClass: dcObject
objectClass: organization
dc: xenit
o: example
createTimestamp: 20220117161334Z
creatorsName: cn=admin,dc=xenit,dc=eu
entryCSN: 20220117161334.188111Z#000000#000#000000
entryDN: dc=xenit,dc=eu
entryUUID:: MjlmZjAwN2UtMGJmYy0xMDNjLTllZWEtZjFjY2M3ZTRiMGI1
hasSubordinates: TRUE
modifiersName: cn=admin,dc=xenit,dc=eu
modifyTimestamp: 20220117161334Z
structuralObjectClass: organization
subschemaSubentry: cn=Subschema
dn: ou=alfresco,dc=xenit,dc=eu
objectClass: organizationalUnit
ou: alfresco
ou: users
createTimestamp: 20220117161334Z
creatorsName: cn=admin,dc=xenit,dc=eu
entryCSN: 20220117161334.191736Z#000000#000#000000
entryDN: ou=alfresco,dc=xenit,dc=eu
entryUUID:: MjlmZjhlMGUtMGJmYy0xMDNjLTllZWItZjFjY2M3ZTRiMGI1
hasSubordinates: TRUE
modifiersName: cn=admin,dc=xenit,dc=eu
modifyTimestamp: 20220117161334Z
structuralObjectClass: organizationalUnit
subschemaSubentry: cn=Subschema
dn: cn=red,ou=alfresco,dc=xenit,dc=eu
objectClass: inetOrgPerson
objectClass: posixAccount
objectClass: shadowAccount
cn: red
cn: User1
gidNumber: 1000
homeDirectory: /home/red
sn: Bar1
uid: red
uidNumber: 1000
userPassword:: cmVk
createTimestamp: 20220117161334Z
creatorsName: cn=admin,dc=xenit,dc=eu
entryCSN: 20220117161334.197027Z#000000#000#000000
entryDN: cn=red,ou=alfresco,dc=xenit,dc=eu
entryUUID:: MmEwMDVkOGUtMGJmYy0xMDNjLTllZWMtZjFjY2M3ZTRiMGI1
hasSubordinates: FALSE
modifiersName: cn=admin,dc=xenit,dc=eu
modifyTimestamp: 20220117161334Z
structuralObjectClass: inetOrgPerson
subschemaSubentry: cn=Subschema
dn: cn=blue,ou=alfresco,dc=xenit,dc=eu
objectClass: inetOrgPerson
objectClass: posixAccount
objectClass: shadowAccount
cn: blue
cn: User2
gidNumber: 1001
homeDirectory: /home/blue
sn: Bar2
uid: blue
uidNumber: 1001
userPassword:: Ymx1ZQ==
createTimestamp: 20220117161334Z
creatorsName: cn=admin,dc=xenit,dc=eu
entryCSN: 20220117161334.203861Z#000000#000#000000
entryDN: cn=blue,ou=alfresco,dc=xenit,dc=eu
entryUUID:: MmEwMTY4YTAtMGJmYy0xMDNjLTllZWQtZjFjY2M3ZTRiMGI1
hasSubordinates: FALSE
modifiersName: cn=admin,dc=xenit,dc=eu
modifyTimestamp: 20220117161334Z
structuralObjectClass: inetOrgPerson
subschemaSubentry: cn=Subschema
dn: cn=users,ou=alfresco,dc=xenit,dc=eu
objectClass: groupOfNames
cn: users
member: cn=blue,ou=alfresco,dc=xenit,dc=eu
member: cn=red,ou=alfresco,dc=xenit,dc=eu
createTimestamp: 20220117161334Z
creatorsName: cn=admin,dc=xenit,dc=eu
entryCSN: 20220117161334.210702Z#000000#000#000000
entryDN: cn=users,ou=alfresco,dc=xenit,dc=eu
entryUUID:: MmEwMjczYzYtMGJmYy0xMDNjLTllZWUtZjFjY2M3ZTRiMGI1
hasSubordinates: FALSE
modifiersName: cn=admin,dc=xenit,dc=eu
modifyTimestamp: 20220117161334Z
structuralObjectClass: groupOfNames
subschemaSubentry: cn=Subschema
dn: cn=aoslink,ou=alfresco,dc=xenit,dc=eu
objectClass: groupOfNames
objectClass: top
cn: aoslink
member: cn=blue,ou=alfresco,dc=xenit,dc=eu
createTimestamp: 20220117163003Z
creatorsName: cn=admin,dc=xenit,dc=eu
entryCSN: 20220117163003.451742Z#000000#000#000000
entryDN: cn=aoslink,ou=alfresco,dc=xenit,dc=eu
entryUUID:: NzdhNGFiOWMtMGJmZS0xMDNjLTg5N2UtMjU3MWE4NTc4OTA4
hasSubordinates: FALSE
modifiersName: cn=admin,dc=xenit,dc=eu
modifyTimestamp: 20220117163003Z
structuralObjectClass: groupOfNames
subschemaSubentry: cn=Subschema
Client import error log
version: 1
#!RESULT ERROR
#!CONNECTION ldap://localhost:1389
#!DATE 2022-01-17T17:37:36.043
#!ERROR [LDAP result code 53 - unwillingToPerform] no global superior knowledge
dn: dc=xenit,dc=eu
objectClass: dcObject
objectClass: organization
dc: xenit
o: example
createTimestamp: 20220117161334Z
creatorsName: cn=admin,dc=xenit,dc=eu
entryCSN: 20220117161334.188111Z#000000#000#000000
entryDN: dc=xenit,dc=eu
entryUUID:: MjlmZjAwN2UtMGJmYy0xMDNjLTllZWEtZjFjY2M3ZTRiMGI1
hasSubordinates: TRUE
modifiersName: cn=admin,dc=xenit,dc=eu
modifyTimestamp: 20220117161334Z
structuralObjectClass: organization
subschemaSubentry: cn=Subschema
#!RESULT ERROR
#!CONNECTION ldap://localhost:1389
#!DATE 2022-01-17T17:37:36.044
#!ERROR [LDAP result code 53 - unwillingToPerform] no global superior knowledge
dn: ou=alfresco,dc=xenit,dc=eu
objectClass: organizationalUnit
ou: alfresco
ou: users
createTimestamp: 20220117161334Z
creatorsName: cn=admin,dc=xenit,dc=eu
entryCSN: 20220117161334.191736Z#000000#000#000000
entryDN: ou=alfresco,dc=xenit,dc=eu
entryUUID:: MjlmZjhlMGUtMGJmYy0xMDNjLTllZWItZjFjY2M3ZTRiMGI1
hasSubordinates: TRUE
modifiersName: cn=admin,dc=xenit,dc=eu
modifyTimestamp: 20220117161334Z
structuralObjectClass: organizationalUnit
subschemaSubentry: cn=Subschema
#!RESULT ERROR
#!CONNECTION ldap://localhost:1389
#!DATE 2022-01-17T17:37:36.045
#!ERROR [LDAP result code 53 - unwillingToPerform] no global superior knowledge
dn: cn=red,ou=alfresco,dc=xenit,dc=eu
objectClass: inetOrgPerson
objectClass: posixAccount
objectClass: shadowAccount
cn: red
cn: User1
gidNumber: 1000
homeDirectory: /home/red
sn: Bar1
uid: red
uidNumber: 1000
userPassword:: cmVk
createTimestamp: 20220117161334Z
creatorsName: cn=admin,dc=xenit,dc=eu
entryCSN: 20220117161334.197027Z#000000#000#000000
entryDN: cn=red,ou=alfresco,dc=xenit,dc=eu
entryUUID:: MmEwMDVkOGUtMGJmYy0xMDNjLTllZWMtZjFjY2M3ZTRiMGI1
hasSubordinates: FALSE
modifiersName: cn=admin,dc=xenit,dc=eu
modifyTimestamp: 20220117161334Z
structuralObjectClass: inetOrgPerson
subschemaSubentry: cn=Subschema
#!RESULT ERROR
#!CONNECTION ldap://localhost:1389
#!DATE 2022-01-17T17:37:36.047
#!ERROR [LDAP result code 53 - unwillingToPerform] no global superior knowledge
dn: cn=blue,ou=alfresco,dc=xenit,dc=eu
objectClass: inetOrgPerson
objectClass: posixAccount
objectClass: shadowAccount
cn: blue
cn: User2
gidNumber: 1001
homeDirectory: /home/blue
sn: Bar2
uid: blue
uidNumber: 1001
userPassword:: Ymx1ZQ==
createTimestamp: 20220117161334Z
creatorsName: cn=admin,dc=xenit,dc=eu
entryCSN: 20220117161334.203861Z#000000#000#000000
entryDN: cn=blue,ou=alfresco,dc=xenit,dc=eu
entryUUID:: MmEwMTY4YTAtMGJmYy0xMDNjLTllZWQtZjFjY2M3ZTRiMGI1
hasSubordinates: FALSE
modifiersName: cn=admin,dc=xenit,dc=eu
modifyTimestamp: 20220117161334Z
structuralObjectClass: inetOrgPerson
subschemaSubentry: cn=Subschema
#!RESULT ERROR
#!CONNECTION ldap://localhost:1389
#!DATE 2022-01-17T17:37:36.049
#!ERROR [LDAP result code 53 - unwillingToPerform] no global superior knowledge
dn: cn=users,ou=alfresco,dc=xenit,dc=eu
objectClass: groupOfNames
cn: users
member: cn=blue,ou=alfresco,dc=xenit,dc=eu
member: cn=red,ou=alfresco,dc=xenit,dc=eu
createTimestamp: 20220117161334Z
creatorsName: cn=admin,dc=xenit,dc=eu
entryCSN: 20220117161334.210702Z#000000#000#000000
entryDN: cn=users,ou=alfresco,dc=xenit,dc=eu
entryUUID:: MmEwMjczYzYtMGJmYy0xMDNjLTllZWUtZjFjY2M3ZTRiMGI1
hasSubordinates: FALSE
modifiersName: cn=admin,dc=xenit,dc=eu
modifyTimestamp: 20220117161334Z
structuralObjectClass: groupOfNames
subschemaSubentry: cn=Subschema
#!RESULT ERROR
#!CONNECTION ldap://localhost:1389
#!DATE 2022-01-17T17:37:36.051
#!ERROR [LDAP result code 53 - unwillingToPerform] no global superior knowledge
dn: cn=aoslink,ou=alfresco,dc=xenit,dc=eu
objectClass: groupOfNames
objectClass: top
cn: aoslink
member: cn=blue,ou=alfresco,dc=xenit,dc=eu
createTimestamp: 20220117163003Z
creatorsName: cn=admin,dc=xenit,dc=eu
entryCSN: 20220117163003.451742Z#000000#000#000000
entryDN: cn=aoslink,ou=alfresco,dc=xenit,dc=eu
entryUUID:: NzdhNGFiOWMtMGJmZS0xMDNjLTg5N2UtMjU3MWE4NTc4OTA4
hasSubordinates: FALSE
modifiersName: cn=admin,dc=xenit,dc=eu
modifyTimestamp: 20220117163003Z
structuralObjectClass: groupOfNames
subschemaSubentry: cn=Subschema
Update 1
Tried a simpler search with ldapsearch based on Oleg's answer, but ended up with the same errors:
ldapsearch -L -b dc=xenit,dc=eu -s sub -x -D cn=admin,dc=xenit,dc=eu -w admin -H ldap://localhost:1389 > /home/red/Desktop/TMP/reduced2.ldif
version: 1
#
# LDAPv3
# base <dc=xenit,dc=eu> with scope subtree
# filter: (objectclass=*)
# requesting: ALL
#
# xenit.eu
#!RESULT ERROR
#!CONNECTION ldap://localhost:7070
#!DATE 2022-01-20T11:17:59.541
#!ERROR [LDAP result code 53 - unwillingToPerform] no global superior knowledge
dn: dc=xenit,dc=eu
objectClass: dcObject
objectClass: organization
dc: xenit
o: example
# alfresco, xenit.eu
#!RESULT ERROR
#!CONNECTION ldap://localhost:7070
#!DATE 2022-01-20T11:17:59.543
#!ERROR [LDAP result code 53 - unwillingToPerform] no global superior knowledge
dn: ou=alfresco,dc=xenit,dc=eu
objectClass: organizationalUnit
ou: users
ou: alfresco
# red, alfresco, xenit.eu
#!RESULT ERROR
#!CONNECTION ldap://localhost:7070
#!DATE 2022-01-20T11:17:59.546
#!ERROR [LDAP result code 53 - unwillingToPerform] no global superior knowledge
dn: cn=red,ou=alfresco,dc=xenit,dc=eu
cn: User1
cn: red
sn: Bar1
objectClass: inetOrgPerson
objectClass: posixAccount
objectClass: shadowAccount
userPassword:: cmVk
uid: red
uidNumber: 1000
gidNumber: 1000
homeDirectory: /home/red
# blue, alfresco, xenit.eu
#!RESULT ERROR
#!CONNECTION ldap://localhost:7070
#!DATE 2022-01-20T11:17:59.549
#!ERROR [LDAP result code 53 - unwillingToPerform] no global superior knowledge
dn: cn=blue,ou=alfresco,dc=xenit,dc=eu
cn: User2
cn: blue
sn: Bar2
objectClass: inetOrgPerson
objectClass: posixAccount
objectClass: shadowAccount
userPassword:: Ymx1ZQ==
uid: blue
uidNumber: 1001
gidNumber: 1001
homeDirectory: /home/blue
# aoslink, alfresco, xenit.eu
#!RESULT ERROR
#!CONNECTION ldap://localhost:7070
#!DATE 2022-01-20T11:17:59.554
#!ERROR [LDAP result code 53 - unwillingToPerform] no global superior knowledge
dn: cn=aoslink,ou=alfresco,dc=xenit,dc=eu
cn: aoslink
objectClass: groupOfNames
member: cn=red,ou=alfresco,dc=xenit,dc=eu
member: cn=blue,ou=alfresco,dc=xenit,dc=eu
# search result
# numResponses: 6
# numEntries: 5

You exported system attributes of the nodes from ApacheDS.
To import the file you need only the regular ones.
You need to adjust the attributes filter in ApacheDS or ldapsearch(if you want to use it instead). It seems it contained + character, but you need *. Please, check this doc for additional info: https://man7.org/linux/man-pages/man1/ldapsearch.1.html
If ldapsearch finds one or more entries, the attributes specified
by attrs are returned. If * is listed, all user attributes are
returned. If + is listed, all operational attributes are
returned. If no attrs are listed, all user attributes are
returned. If only 1.1 is listed, no attributes will be returned.
# UPDATE
Keep in mind that your dc=xenit should also be created before referencing it in further steps. You start immediately with the level of *.xenit.eu, but should with *.eu. see example of organisation initialisation in the official doc

Related

windows command line csr file certreq.exe output bad format on Subject ,Issue to, and issue by

Windows command line CSR file
`certreq.exe -new C:\Certs\template.inf C:\Certs\mydomain.txt.csr`
returns:
bad format on Subject ,Issue to, and issue by this format
The template.inf has
Subject = "CN=mydomain.com, OU=IT, O=My Company, L=my city, S=my state, C=US
I get this on
Issue to: CN=mydomain.com, OU=IT, O=My Company, L=my city, S=my state, C=US in 1 line.
same for
issue by: CN=mydomain.com, OU=IT, O=My Company, L=my city, S=my state, C=US
also
Subject : CN=mydomain.com, OU=IT, O=My Company, L=my city, S=my state, C=US
With the IIS server certificates mmc. I get the below, the desired result
CN = mydomain.com
OU = IT
O = My Company
L = my city
S = my state
C = US
All the documentation says to put it all in 1 line in the template file.
Can some one please advice?
Take the following *.inf as source template to generate a web server certificate:
[Version]
Signature="$Windows NT$"
[Strings]
szOID_SAN = "2.5.29.17"
szOID_ENHANCED_KEY_USAGE = "2.5.29.37"
szOID_PKIX_KP_SERVER_AUTH = "1.3.6.1.5.5.7.3.1"
[NewRequest]
Exportable=False
SMIME=False
Hashalgorithm=SHA256
KeyLength=2048
KeySpec = AT_KEYEXCHANGE
KeyUsage = "CERT_DIGITAL_SIGNATURE_KEY_USAGE | CERT_KEY_ENCIPHERMENT_KEY_USAGE"
RequestType=PKCS10; PKCS10 or CMC
Subject="CN=mydomain.com, OU=IT, O=My Company, L=my city, S=my state, C=US"
ProviderName="Microsoft Software Key Storage Provider"
MachineKeySet=True
[Extensions]
%szOID_SAN%="{text}"
_continue_ = "DNS=mydomain.com&"
%szOID_ENHANCED_KEY_USAGE%="{text}"
_continue_ = "%szOID_PKIX_KP_SERVER_AUTH%,"
I used your subject and for better compatibility with browsers I also added the CN value as DNS Host Name to the subject alternative name.
As MachineKeySet is set to True the following command must be run with administrative privileges:
& certreq.exe -New ".\Template.inf" "CertificateSigningRequest.p10"

Extracting specific value from stderr_lines

This is my ansible script
- name: show1
debug:
msg: "{{response.stderr_lines}}"
Here is the output
msg:
- Using endpoint [https://us-central1-aiplatform.googleapis.com/]
- CustomJob [projects/123456/locations/us-central1/customJobs/112233445566] is submitted successfully.
- ''
- Your job is still active. You may view the status of your job with the command
- ''
- ' $ gcloud ai custom-jobs describe projects/123456/locations/us-central1/customJobs/112233445566'
- ''
- or continue streaming the logs with the command
- ''
- ' $ gcloud ai custom-jobs stream-logs projects/123456/locations/us-central1/customJobs/112233445566'
Here I want to extract custom Job ID which is 112233445566
I used the select module like below
- name: show
debug:
msg: "{{train_custom_image_unmanaged_response.stderr_lines | select('search', 'describe') | list }}"
and it gives me this output
msg:
- ' $ gcloud ai custom-jobs describe projects/123456/locations/us-central1/customJobs/112233445566'
But I just want the job id as specified above. Any idea about that ?
Thanks.
You selected the line you are interested in. From that now you want to isolate the job id number in the end. You can do that using a regular expression like so:
- set_fact:
line: "{{train_custom_image_unmanaged_response.stderr_lines | select('search', 'describe') | list }}"
- debug:
msg: "{{ line | regex_search('.*/customJobs/(\\d+)', '\\1') }}"
This will give you all the digits in the end of the line after /customJobs/. See https://docs.ansible.com/ansible/latest/user_guide/playbooks_filters.html#searching-strings-with-regular-expressions

How to insert rows if not exist in Liquibase in Yaml format

I have a Table A:
A
--------------
id | name |
How to insert rows in this table if row with such NAME already exists.
I need to do it in Liquibase in Yaml format
Liquibase changesets can be executed on a given precondition. In your case you could run a sqlCheck:
- changeSet:
id: 1
author: me
preConditions:
- onFail: MARK_RAN
- sqlCheck:
expectedResult: 0
sql: SELECT COUNT(*) FROM person WHERE name = 'John'
changes:
- insert:
tableName: person
columns:
- column:
name: id
value: 2
- column:
name: name
value: John

Gatling - No attribute named 'CSRF' is defined

I get this error that my attribute is not defined and I can't figure out why.
I have it it first saved in my first request as CSRF variable.
Later on I try to access it while doing post request to fill out the form.
This is my main simulation class:
package simulations.stage
import io.ecx.steps.{Config, Login}
import io.gatling.core.Predef._
import io.gatling.core.structure.ScenarioBuilder
import io.gatling.http.Predef._
import io.gatling.http.protocol.HttpProtocolBuilder
import scala.concurrent.duration._
class RampUsersLoadSimulations extends Simulation{
val httpConf: HttpProtocolBuilder = http.baseUrl(Config.baseUrl)
.header("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8")
.userAgentHeader("Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/88.0.4324.190 Safari/537.36")
.inferHtmlResources()
.acceptEncodingHeader("gzip, deflate, br")
.proxy(Proxy("localhost", 8866))
before {
println(s"Running for: ${Config.baseUrl}")
}
val login: ScenarioBuilder = scenario("Scenario: Login to the storefront")
.exec(
Login.login(Config.accounts),
Login.navigateToMyAccountPage())
setUp(login.inject(atOnceUsers(1))).protocols(httpConf)
}
This is my steps object where I try to save it and then use it in the post request:
package io.ecx.steps
import io.gatling.core.Predef._
import io.gatling.http.Predef._
object Login {
def login(accountsPath: String) = {
val accounts = csv(accountsPath).random
exec(http("Load Login Page")
.get("/login")
.check(regex("<title>My Title</title>").exists)
.check(css("[name=CSRFToken]", "value").saveAs("CSRF"))
.check(status.is(200)))
.pause(2)
// .exec{session => println(session); session}
feed(accounts)
.exec(http("Log in with credentials to the storefront")
.post("/j_spring_security_check")
.formParam("username", "${username}")
.formParam("password", "${password}")
.formParam("rememberMe", "${rememberMe}")
.formParam("CSRFToken", "${CSRF}")
.check(css("#loginForm").notExists)
.check(status.in(200)))
.pause(5)
}
def navigateToMyAccountPage() = {
exec(http("Open My account Page")
.get("accountSummary")
.check(css(".page-AccountSummaryPage").exists)
.check(status.in(200)))
.pause(2)
}
}
In the HTML that is loaded when login page loads we have:
<input type="hidden" name="CSRFToken" value="6ac89c39-ee25-4cdc-9553-cc8a7824f43b" />
This is the logs:
Simulation simulations.stage.RampUsersLoadSimulations started...
Session(Scenario: Login to the storefront,1,Map(gatling.http.ssl.sslContexts -> io.gatling.http.util.SslContexts#6e62fe0c, gatling.http.cache.dns -> io.gatling.http.resolver.ShufflingNameResolver#56fe67f3, gatling.http.cache.baseUrl -> https://my-site.com),KO,List(),io.gatling.core.protocol.ProtocolComponentsRegistry$$Lambda$434/1485485458#7dcefc4,io.netty.channel.nio.NioEventLoop#70f02c32)
23:29:59.611 [ERROR] i.g.h.a.HttpRequestAction - 'httpRequest-4' failed to execute: No attribute named 'CSRF' is defined
================================================================================
2021-03-03 23:30:00 5s elapsed
---- Requests ------------------------------------------------------------------
> Global (OK=0 KO=1 )
> Load Login Page (OK=0 KO=1 )
---- Errors --------------------------------------------------------------------
> j.n.ConnectException: Connection refused: no further informati 1 (50.00%)
on
> Log in with credentials to the storefront: Failed to build req 1 (50.00%)
uest: No attribute named 'CSRF' is defined
---- Scenario: Login to the storefront -----------------------------------------
[--------------------------------------------------------------------------] 0%
waiting: 0 / active: 1 / done: 0
================================================================================
================================================================================
2021-03-03 23:30:05 10s elapsed
---- Requests ------------------------------------------------------------------
> Global (OK=0 KO=1 )
> Load Login Page (OK=0 KO=1 )
---- Errors --------------------------------------------------------------------
> j.n.ConnectException: Connection refused: no further informati 1 (50.00%)
on
> Log in with credentials to the storefront: Failed to build req 1 (50.00%)
uest: No attribute named 'CSRF' is defined
---- Scenario: Login to the storefront -----------------------------------------
[--------------------------------------------------------------------------] 0%
waiting: 0 / active: 1 / done: 0
================================================================================
================================================================================
2021-03-03 23:30:08 13s elapsed
---- Requests ------------------------------------------------------------------
> Global (OK=0 KO=2 )
> Load Login Page (OK=0 KO=1 )
> Open My account Page (OK=0 KO=1 )
---- Errors --------------------------------------------------------------------
> j.n.ConnectException: Connection refused: no further informati 2 (66.67%)
on
> Log in with credentials to the storefront: Failed to build req 1 (33.33%)
uest: No attribute named 'CSRF' is defined
---- Scenario: Login to the storefront -----------------------------------------
[##########################################################################]100%
waiting: 0 / active: 0 / done: 1
================================================================================
Simulation simulations.stage.RampUsersLoadSimulations completed in 13 seconds
Parsing log file(s)...
Parsing log file(s) done
Generating reports...
================================================================================
---- Global Information --------------------------------------------------------
> request count 2 (OK=0 KO=2 )
> min response time 2015 (OK=- KO=2015 )
> max response time 2019 (OK=- KO=2019 )
> mean response time 2017 (OK=- KO=2017 )
> std deviation 2 (OK=- KO=2 )
> response time 50th percentile 2017 (OK=- KO=2017 )
> response time 75th percentile 2018 (OK=- KO=2018 )
> response time 95th percentile 2019 (OK=- KO=2019 )
> response time 99th percentile 2019 (OK=- KO=2019 )
> mean requests/sec 0.143 (OK=- KO=0.143 )
---- Response Time Distribution ------------------------------------------------
> t < 800 ms 0 ( 0%)
> 800 ms < t < 1200 ms 0 ( 0%)
> t > 1200 ms 0 ( 0%)
> failed 2 (100%)
---- Errors --------------------------------------------------------------------
> j.n.ConnectException: Connection refused: no further informati 2 (66.67%)
on
> Log in with credentials to the storefront: Failed to build req 1 (33.33%)
uest: No attribute named 'CSRF' is defined
================================================================================
Could it be that I have this behavior because the input field is marked as hidden?
Or there is something I can't see.
Please help.
Thanks!
You have an error in your code: you're missing a dot before feed(accounts). Because of this, it's not attached to the head and only the tail is considered.

Sorting ansible output

Below is my ansible task output.
TASK [debug] **************************************************************************************************** **************************************
ok: [server01] => {
"my_updates.stdout_lines": [
"",
"",
"Title : Definition Update for Windows Defender Antivirus - KB2267602 (Definition 1.297.486.0)",
"",
"",
""
]
}
ok: [server02] => {
"my_updates.stdout_lines": [
"",
"",
"Title : 2020-08 Cumulative Update for Windows Server 2016 for x64-based Systems",
"",
"",
""
]
}
I only want entries
Definition Update for Windows Defender Antivirus - KB2267602 (Definition 1.297.486.0)
2020-08 Cumulative Update for Windows Server 2016 for x64-based Systems
So i tried below method,
- name: Fetch Update List
shell: echo {{ my_updates.stdout_lines }} | tr -s ' ' | sed 's/[][]//g' | sed 's/u,//g' | sed 's/u //g' | sed 's/ u//g' | sed 's/),/)/g'
delegate_to: 127.0.0.1
register: my_sec_result
when: ansible_os_family == "Windows" and my_updates.stdout_lines | length |int > 0
- debug:
var: my_sec_result.stdout_lines
but this wont help, it gives me below output
TASK [debug] ******************************************************************************************************************************************
ok: [server01] => {
"my_sec_result.stdout_lines": [
"Title : Definition Update for Windows Defender Antivirus - KB2267602 (Definition 1.297.486.0) "
]
}
ok: [server02] => {
"my_sec_result.stdout_lines": [
"Title : 2020-08 Cumulative Update for Windows Server 2016 for x64-based Systems "
]
}
How to get only these Entries, At present only one entry each found on each server. There can be multiple entries.
Definition Update for Windows Defender Antivirus - KB2267602 (Definition 1.297.486.0)
2020-08 Cumulative Update for Windows Server 2016 for x64-based Systems
In your initial list, reject lines which are empty strings then remove the prepending "Title : " with the regexp_replace filter. The following task does it all in one:
- name: Display updates
debug:
msg: "{{ my_updates.stdout_lines | reject('eq', '') | map('regex_replace', 'Title : (.*)', '\\g<1>') | list }}"
Update: As pointed out by #Vladimir, in this case your can replace reject with select for a cleaner template string:
- name: Display updates
debug:
msg: "{{ my_updates.stdout_lines | select() | map('regex_replace', 'Title : (.*)', '\\g<1>') | list }}"