Related
When i am passing the userName as a variable inside data key in the below request then not able to fetch the value. I got the userName in the Login request response. Here UserName and playerName are the same.
Login Request:
42[
"get_login",
{
"key": "AUEEW891WL",
"socketId":"${sid}",
"username": "",
"avatar": "",
"language": "en",
"playerMove": "",
"joinGame": "",
"replay": 0,
"gameID": 0,
"gameNo": 0,
"data": "&email=llk${counter5}#gmail.com&password=poker",
"players": 0,
"level": "",
"lastAction": "",
"game": "",
"playMoney": 1,
"role": ""
}
]
Response:
42[
"gotLogin",
{
"response": {
"playerId": 25601,
"totalWin": 0,
"points": 0,
"playerName": "673508846384",
"displayName": "llk45",
"playerRank": "Amateur",
"playerBank": "11K",
"playerBankAmount": 11000,
"playerAvatar": "avatar1.jpg",
"playerEmail": "llk45#gmail.com",
"playerLevel": 1,
"playerLevelStr": "Lvl. 1",
"playerLevelPrg": 0,
"playerLevelPoints": 100,
"playerGold": 0,
"playerDealerId": 1,
"playerFbId": "",
"loadVocab": "",
"dailyBonus": 0,
"token": "0a5260592b6efc02d3102c639eac0f60d91ad7de8bf57fa114da179f05bcfa84",
"ip": "182.74.4.226",
"interface": {
"home": [
{
"buttonTitle": "Casino",
"buttonIcon": "casino-icon",
"buttonAction": {
"type": "function",
"name": "loadLobby"
}
},
{
"buttonTitle": "Leagues",
"buttonIcon": "leagues-icon",
"buttonAction": {
"type": "function",
"name": "loadLobby"
}
},
{
"buttonTitle": "Clubs",
"buttonIcon": "clubs-icon",
"buttonAction": {
"type": "function",
"name": "loadLobby"
}
},
{
"buttonTitle": "Cashier",
"buttonIcon": "cashier-icon",
"buttonAction": {
"type": "panel",
"name": "pnlChipStore"
}
},
{
"buttonTitle": "Settings",
"buttonIcon": "settings-icon",
"buttonAction": {
"type": "panel",
"name": "pnlSettings"
}
},
{
"buttonTitle": "Notifications",
"buttonIcon": "notifications-icon",
"buttonAction": {
"type": "panel",
"name": "pnlLevel"
}
}
]
},
"playerCountry": "IN",
"role": 1
}
}
]
Request:
42[
"create_game",
{
"key": "AUEEW891WL",
"socketId":"${sid}",
"username": ${userName}",
"avatar": "avatar17.jpg",
"language": "en",
"playerMove": "",
"joinGame": "",
"replay": 0,
"gameID": 0,
"gameNo": 0,
"data": "&gameID=undefined&game=texas&playMoney=1&gameStyle=private-cashgame&tableName=llkTable${counter1}&rakeRate=0&speed=60&sb=10&bb=20&tablelow=100&tablelimit=1000&videorequired=false&username=${userName}",
"players": 0,
"level": 347,
"lastAction": "",
"game": "",
"playMoney": 1,
"role": "1",
"token":"${token}",
"playerId":"${playerId}"
}
]
Response Request:
42[
"create_game",
{
"key": "AUEEW891WL",
"socketId":"TRV8Rm_jtsqn_BBFAAiM",
"username": "673508846384",
"avatar": "avatar17.jpg",
"language": "en",
"playerMove": "",
"joinGame": "",
"replay": 0,
"gameID": 0,
"gameNo": 0,
"data": "&gameID=undefined&game=texas&playMoney=1&gameStyle=private-cashgame&tableName=llkTable47&rakeRate=0&speed=60&sb=10&bb=20&tablelow=100&tablelimit=1000&videorequired=false&username="673508846384",
"players": 0,
"level": 347,
"lastAction": "",
"game": "",
"playMoney": 1,
"role": "1",
"token":"0a5260592b6efc02d3102c639eac0f60d91ad7de8bf57fa114da179f05bcfa84",
"playerId":"25601"
}
]
Here is the screenshot:
enter image description here
How can i pass this value in the create game request inside the data key to fetch it?
If your ${userName} variable has value (i.e. it was set via User Defined Variables or comes from a Post-Processor or it's from the CSV Data Set Config) - JMeter will send the value in the request.
If the variable doesn't have the value - JMeter will send ${userName}
So double check that the ${userName} variable:
Exists
Has its respective value
It can be done using Debug Sampler and View Results Tree listener combination.
I had a problem when installing a kubernetes cluster of 3 masters and 6 workers and 1 ingress, I did not find that someone would have a similar problem. "TASK [kubespray-defaults : create fallback_ips_base] *****
fatal: [k8s-worker1]: FAILED! => {"msg": "The task includes an option with an undefined variable. The error was: 'None' has no attribute 'get'\n\nThe error appears to be in '/kubespray/roles/kubespray-defaults/tasks/fallback_ips.yml': line 15, column 3, but may\nbe elsewhere in the file depending on the exact syntax problem.\n\nThe offending line appears to be:\n\n\n- name: create fallback_ips_base\n ^ here\n"}"
Command output printf "$(uname -srm)\n$(cat /etc/os-release)\n"
Linux 3.10.0-1160.62.1.el7.x86_64 x86_64
NAME="CentOS Linux"
VERSION="7 (Core)"
ID="centos"
ID_LIKE="rhel fedora"
VERSION_ID="7"
PRETTY_NAME="CentOS Linux 7 (Core)"
ANSI_COLOR="0;31"
CPE_NAME="cpe:/o:centos:centos:7"
HOME_URL="https://www.centos.org/"
BUG_REPORT_URL="https://bugs.centos.org/"
CENTOS_MANTISBT_PROJECT="CentOS-7"
CENTOS_MANTISBT_PROJECT_VERSION="7"
REDHAT_SUPPORT_PRODUCT="centos"
REDHAT_SUPPORT_PRODUCT_VERSION="7"
ansible --version
ansible 2.10.11
config file = /kubespray/ansible.cfg
configured module search path = ['/kubespray/library']
ansible python module location = /usr/local/lib/python3.6/site-packages/ansible
executable location = /usr/local/bin/ansible
python version = 3.6.8 (default, Nov 16 2020, 16:55:22) [GCC 4.8.5 20150623 (Red Hat 4.8.5-44)]
Version of Python (python --version):
Python 2.7.5
Network plugin used:
flannel
nodes:
k8s-master1 ansible_host=172.16.18.141 ip=172.16.18.141
k8s-master2 ansible_host=172.16.18.133 ip=172.16.18.133
k8s-master3 ansible_host=172.16.18.134 ip=172.16.18.134
k8s-worker1 ansible_host=172.16.18.135 ip=172.16.18.135
k8s-worker2 ansible_host=172.16.18.136 ip=172.16.18.136
k8s-worker3 ansible_host=172.16.18.137 ip=172.16.18.137
k8s-worker4 ansible_host=172.16.18.138 ip=172.16.18.138
k8s-worker5 ansible_host=172.16.18.140 ip=172.16.18.140
k8s-worker6 ansible_host=172.16.18.139 ip=172.16.18.139
k8s-ingress ansible_host=172.16.18.142 ip=172.16.18.142
[kube_control_plane]
k8s-master1
k8s-master2
k8s-master3
[etcd]
k8s-master2
k8s-master3
k8s-master1
[kube_node]
k8s-worker1
k8s-worker2
k8s-worker3
k8s-worker4
k8s-worker5
k8s-worker6
k8s-ingress
[kube_ingress]
k8s-ingress
[k8s_cluster:children]
kube_node
kube_control_plane
ansible -m setup:
k8s-worker1 | SUCCESS => {
"ansible_facts": {
"ansible_apparmor": {
"status": "disabled"
},
"ansible_architecture": "x86_64",
"ansible_bios_date": "09/17/2015",
"ansible_bios_vendor": "Phoenix Technologies LTD",
"ansible_bios_version": "6.00",
"ansible_board_asset_tag": "NA",
"ansible_board_name": "440BX Desktop Reference Platform",
"ansible_board_serial": "None",
"ansible_board_vendor": "Intel Corporation",
"ansible_board_version": "None",
"ansible_chassis_asset_tag": "No Asset Tag",
"ansible_chassis_serial": "None",
"ansible_chassis_vendor": "No Enclosure",
"ansible_chassis_version": "N/A",
"ansible_cmdline": {
"BOOT_IMAGE": "/vmlinuz-3.10.0-1160.62.1.el7.x86_64",
"LANG": "en_US.UTF-8",
"crashkernel": "auto",
"quiet": true,
"rd.lvm.lv": "centos/swap",
"rhgb": true,
"ro": true,
"root": "/dev/mapper/centos-root"
},
"ansible_date_time": {
"date": "2022-06-02",
"day": "02",
"epoch": "1654127793",
"hour": "02",
"iso8601": "2022-06-01T23:56:33Z",
"iso8601_basic": "20220602T025633575892",
"iso8601_basic_short": "20220602T025633",
"iso8601_micro": "2022-06-01T23:56:33.575892Z",
"minute": "56",
"month": "06",
"second": "33",
"time": "02:56:33",
"tz": "IDT",
"tz_offset": "+0300",
"weekday": "Thursday",
"weekday_number": "4",
"weeknumber": "22",
"year": "2022"
},
"ansible_device_links": {
"ids": {
"dm-0": [
"dm-name-centos-root",
"dm-uuid-LVM-eq8RdwDh8UmVbxUDFSJojOlSDEbBTzsro1ok8rizmZLLezdQlepE8PQGLJUrOxrb"
],
"dm-1": [
"dm-name-centos-swap",
"dm-uuid-LVM-eq8RdwDh8UmVbxUDFSJojOlSDEbBTzsrRm5FHwbU4faE1weTgRbY2xdwQJs5YPpJ"
],
"dm-2": [
"dm-name-centos-home",
"dm-uuid-LVM-eq8RdwDh8UmVbxUDFSJojOlSDEbBTzsr0wXP3uZEc9Ld1tvj3Cx9dKlN4MhfsbBF"
],
"sda2": [
"lvm-pv-uuid-J3cGFq-UpST-uNKu-8iTN-iWep-Kpxo-Sokz40"
],
"sr0": [
"ata-VMware_Virtual_SATA_CDRW_Drive_00000000000000000001"
]
},
"labels": {},
"masters": {
"sda2": [
"dm-0",
"dm-1",
"dm-2"
]
},
"uuids": {
"dm-0": [
"cdd909fe-d39a-4ea9-8959-fe1aca72a2e8"
],
"dm-1": [
"52b08951-ea16-4abe-8315-35a4261eaef7"
],
"dm-2": [
"18ecd858-0042-4e4d-8c9d-f15236a1c9c7"
],
"sda1": [
"11285025-905b-4798-8560-d1d8900fc90c"
]
}
},
"ansible_devices": {
"dm-0": {
"holders": [],
"host": "",
"links": {
"ids": [
"dm-name-centos-root",
"dm-uuid-LVM-eq8RdwDh8UmVbxUDFSJojOlSDEbBTzsro1ok8rizmZLLezdQlepE8PQGLJUrOxrb"
],
"labels": [],
"masters": [],
"uuids": [
"cdd909fe-d39a-4ea9-8959-fe1aca72a2e8"
]
},
"model": null,
"partitions": {},
"removable": "0",
"rotational": "1",
"sas_address": null,
"sas_device_handle": null,
"scheduler_mode": "",
"sectors": "104857600",
"sectorsize": "512",
"size": "50.00 GB",
"support_discard": "0",
"vendor": null,
"virtual": 1
},
"dm-1": {
"holders": [],
"host": "",
"links": {
"ids": [
"dm-name-centos-swap",
"dm-uuid-LVM-eq8RdwDh8UmVbxUDFSJojOlSDEbBTzsrRm5FHwbU4faE1weTgRbY2xdwQJs5YPpJ"
],
"labels": [],
"masters": [],
"uuids": [
"52b08951-ea16-4abe-8315-35a4261eaef7"
]
},
"model": null,
"partitions": {},
"removable": "0",
"rotational": "1",
"sas_address": null,
"sas_device_handle": null,
"scheduler_mode": "",
"sectors": "12320768",
"sectorsize": "512",
"size": "5.88 GB",
"support_discard": "0",
"vendor": null,
"virtual": 1
},
"dm-2": {
"holders": [],
"host": "",
"links": {
"ids": [
"dm-name-centos-home",
"dm-uuid-LVM-eq8RdwDh8UmVbxUDFSJojOlSDEbBTzsr0wXP3uZEc9Ld1tvj3Cx9dKlN4MhfsbBF"
],
"labels": [],
"masters": [],
"uuids": [
"18ecd858-0042-4e4d-8c9d-f15236a1c9c7"
]
},
"model": null,
"partitions": {},
"removable": "0",
"rotational": "1",
"sas_address": null,
"sas_device_handle": null,
"scheduler_mode": "",
"sectors": "90423296",
"sectorsize": "512",
"size": "43.12 GB",
"support_discard": "0",
"vendor": null,
"virtual": 1
},
"fd0": {
"holders": [],
"host": "",
"links": {
"ids": [],
"labels": [],
"masters": [],
"uuids": []
},
"model": null,
"partitions": {},
"removable": "1",
"rotational": "1",
"sas_address": null,
"sas_device_handle": null,
"scheduler_mode": "deadline",
"sectors": "8",
"sectorsize": "512",
"size": "4.00 KB",
"support_discard": "0",
"vendor": null,
"virtual": 1
},
"sda": {
"holders": [],
"host": "",
"links": {
"ids": [],
"labels": [],
"masters": [],
"uuids": []
},
"model": "Virtual disk",
"partitions": {
"sda1": {
"holders": [],
"links": {
"ids": [],
"labels": [],
"masters": [],
"uuids": [
"11285025-905b-4798-8560-d1d8900fc90c"
]
},
"sectors": "2097152",
"sectorsize": 512,
"size": "1.00 GB",
"start": "2048",
"uuid": "11285025-905b-4798-8560-d1d8900fc90c"
},
"sda2": {
"holders": [
"centos-root",
"centos-swap",
"centos-home"
],
"links": {
"ids": [
"lvm-pv-uuid-J3cGFq-UpST-uNKu-8iTN-iWep-Kpxo-Sokz40"
],
"labels": [],
"masters": [
"dm-0",
"dm-1",
"dm-2"
],
"uuids": []
},
"sectors": "207616000",
"sectorsize": 512,
"size": "99.00 GB",
"start": "2099200",
"uuid": null
}
},
"removable": "0",
"rotational": "1",
"sas_address": null,
"sas_device_handle": null,
"scheduler_mode": "deadline",
"sectors": "209715200",
"sectorsize": "512",
"size": "100.00 GB",
"support_discard": "0",
"vendor": "VMware",
"virtual": 1
},
"sr0": {
"holders": [],
"host": "",
"links": {
"ids": [
"ata-VMware_Virtual_SATA_CDRW_Drive_00000000000000000001"
],
"labels": [],
"masters": [],
"uuids": []
},
"model": "VMware SATA CD00",
"partitions": {},
"removable": "1",
"rotational": "1",
"sas_address": null,
"sas_device_handle": null,
"scheduler_mode": "deadline",
"sectors": "2097151",
"sectorsize": "512",
"size": "1024.00 MB",
"support_discard": "0",
"vendor": "NECVMWar",
"virtual": 1
}
},
"ansible_distribution": "CentOS",
"ansible_distribution_file_parsed": true,
"ansible_distribution_file_path": "/etc/redhat-release",
"ansible_distribution_file_variety": "RedHat",
"ansible_distribution_major_version": "7",
"ansible_distribution_release": "Core",
"ansible_distribution_version": "7.9",
"ansible_dns": {
"nameservers": [
"172.16.1.1"
]
},
"ansible_domain": "s000.local",
"ansible_effective_group_id": 0,
"ansible_effective_user_id": 0,
"ansible_env": {
"HOME": "/root",
"LANG": "C",
"LC_ALL": "C",
"LC_NUMERIC": "C",
"LESSOPEN": "||/usr/bin/lesspipe.sh %s",
"LOGNAME": "root",
"MAIL": "/var/mail/root",
"PATH": "/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin",
"PWD": "/root",
"SELINUX_LEVEL_REQUESTED": "",
"SELINUX_ROLE_REQUESTED": "",
"SELINUX_USE_CURRENT_RANGE": "",
"SHELL": "/bin/bash",
"SHLVL": "2",
"SSH_CLIENT": "172.16.18.131 42184 22",
"SSH_CONNECTION": "172.16.18.131 42184 172.16.18.135 22",
"USER": "root",
"XDG_RUNTIME_DIR": "/run/user/0",
"XDG_SESSION_ID": "19",
"_": "/usr/bin/python"
},
"ansible_fibre_channel_wwn": [],
"ansible_fips": false,
"ansible_form_factor": "Other",
"ansible_fqdn": "k8s-worker1.s000.local",
"ansible_hostname": "k8s-worker1",
"ansible_hostnqn": "",
"ansible_is_chroot": false,
"ansible_iscsi_iqn": "",
"ansible_kernel": "3.10.0-1160.62.1.el7.x86_64",
"ansible_kernel_version": "#1 SMP Tue Apr 5 16:57:59 UTC 2022",
"ansible_local": {},
"ansible_lsb": {},
"ansible_lvm": {
"lvs": {
"home": {
"size_g": "43.12",
"vg": "centos"
},
"root": {
"size_g": "50.00",
"vg": "centos"
},
"swap": {
"size_g": "5.88",
"vg": "centos"
}
},
"pvs": {
"/dev/sda2": {
"free_g": "0.00",
"size_g": "99.00",
"vg": "centos"
}
},
"vgs": {
"centos": {
"free_g": "0.00",
"num_lvs": "3",
"num_pvs": "1",
"size_g": "99.00"
}
}
},
"ansible_machine": "x86_64",
"ansible_machine_id": "32496b187f444d3b95eeafeb0fce0cae",
"ansible_memfree_mb": 5297,
"ansible_memory_mb": {
"nocache": {
"free": 5508,
"used": 297
},
"real": {
"free": 5297,
"total": 5805,
"used": 508
},
"swap": {
"cached": 0,
"free": 0,
"total": 0,
"used": 0
}
},
"ansible_memtotal_mb": 5805,
"ansible_mounts": [
{
"block_available": 210041,
"block_size": 4096,
"block_total": 259584,
"block_used": 49543,
"device": "/dev/sda1",
"fstype": "xfs",
"inode_available": 523954,
"inode_total": 524288,
"inode_used": 334,
"mount": "/boot",
"options": "rw,seclabel,relatime,attr2,inode64,noquota",
"size_available": 860327936,
"size_total": 1063256064,
"uuid": "11285025-905b-4798-8560-d1d8900fc90c"
},
{
"block_available": 12278107,
"block_size": 4096,
"block_total": 13100800,
"block_used": 822693,
"device": "/dev/mapper/centos-root",
"fstype": "xfs",
"inode_available": 26161376,
"inode_total": 26214400,
"inode_used": 53024,
"mount": "/",
"options": "rw,seclabel,relatime,attr2,inode64,noquota",
"size_available": 50291126272,
"size_total": 53660876800,
"uuid": "cdd909fe-d39a-4ea9-8959-fe1aca72a2e8"
},
{
"block_available": 11289145,
"block_size": 4096,
"block_total": 11297393,
"block_used": 8248,
"device": "/dev/mapper/centos-home",
"fstype": "xfs",
"inode_available": 22605821,
"inode_total": 22605824,
"inode_used": 3,
"mount": "/home",
"options": "rw,seclabel,relatime,attr2,inode64,noquota",
"size_available": 46240337920,
"size_total": 46274121728,
"uuid": "18ecd858-0042-4e4d-8c9d-f15236a1c9c7"
}
],
"ansible_nodename": "k8s-worker1",
"ansible_os_family": "RedHat",
"ansible_pkg_mgr": "yum",
"ansible_proc_cmdline": {
"BOOT_IMAGE": "/vmlinuz-3.10.0-1160.62.1.el7.x86_64",
"LANG": "en_US.UTF-8",
"crashkernel": "auto",
"quiet": true,
"rd.lvm.lv": [
"centos/root",
"centos/swap"
],
"rhgb": true,
"ro": true,
"root": "/dev/mapper/centos-root"
},
"ansible_processor": [
"0",
"GenuineIntel",
"Intel(R) Xeon(R) CPU E5-2650 v2 # 2.60GHz",
"1",
"GenuineIntel",
"Intel(R) Xeon(R) CPU E5-2650 v2 # 2.60GHz",
"2",
"GenuineIntel",
"Intel(R) Xeon(R) CPU E5-2650 v2 # 2.60GHz",
"3",
"GenuineIntel",
"Intel(R) Xeon(R) CPU E5-2650 v2 # 2.60GHz"
],
"ansible_processor_cores": 1,
"ansible_processor_count": 4,
"ansible_processor_nproc": 4,
"ansible_processor_threads_per_core": 1,
"ansible_processor_vcpus": 4,
"ansible_product_name": "VMware Virtual Platform",
"ansible_product_serial": "VMware-56 4d f7 52 8a 2f 19 11-ea 9d 2f c8 ed 50 ef 3e",
"ansible_product_uuid": "564DF752-8A2F-1911-EA9D-2FC8ED50EF3E",
"ansible_product_version": "None",
"ansible_python": {
"executable": "/usr/bin/python",
"has_sslcontext": true,
"type": "CPython",
"version": {
"major": 2,
"micro": 5,
"minor": 7,
"releaselevel": "final",
"serial": 0
},
"version_info": [
2,
7,
5,
"final",
0
]
},
"ansible_python_version": "2.7.5",
"ansible_real_group_id": 0,
"ansible_real_user_id": 0,
"ansible_selinux": {
"config_mode": "permissive",
"mode": "permissive",
"policyvers": 31,
"status": "enabled",
"type": "targeted"
},
"ansible_selinux_python_present": true,
"ansible_service_mgr": "systemd",
"ansible_ssh_host_key_ecdsa_public": "AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBHqsSpmuUFd15ttkWjkpvPgflGaP1ESchUZA8MI0CTviJIHUCz2h3mH1PMTMZwqnaAkdOp1sJQjT09omvBBets0=",
"ansible_ssh_host_key_ecdsa_public_keytype": "ecdsa-sha2-nistp256",
"ansible_ssh_host_key_ed25519_public": "AAAAC3NzaC1lZDI1NTE5AAAAIEaCutePk/HnsQX6kFpBZxPqCIfF8i7kYnj5xRQjBI6A",
"ansible_ssh_host_key_ed25519_public_keytype": "ssh-ed25519",
"ansible_ssh_host_key_rsa_public": "AAAAB3NzaC1yc2EAAAADAQABAAABAQDAzM6HtHaQKXZEZ127SSzfLkr4WEz2EGWdTRKZJCQWsxwJmMckWOP7gaC5jHEQ50pu03BH0JrSq9sH4mBuxkB7tudsEMruoSYmfODvrJ39aQDTtDCbrtCvXWLcFmtwfpawrN2FrsqMz7wrvcfSR/t8Nmx3eRtuSXhFTj30mQJ9bEUQHuL3+BGrjaJArzFVWvbkvuPFn1nvAYdoXwSGrBIFq6vVNyA+1IIt3bZH1ZRMwPxCqQ2xxZA8nRnxGSpaZaNN9DiM+64Z1goTzFAXZXRDpx2YqyDF7vImNRpuJFNTCHpCHTbFWVjBre51HAgJoTLen+LafiF52elaGTgS+H6l",
"ansible_ssh_host_key_rsa_public_keytype": "ssh-rsa",
"ansible_swapfree_mb": 0,
"ansible_swaptotal_mb": 0,
"ansible_system": "Linux",
"ansible_system_capabilities": [
"cap_chown",
"cap_dac_override",
"cap_dac_read_search",
"cap_fowner",
"cap_fsetid",
"cap_kill",
"cap_setgid",
"cap_setuid",
"cap_setpcap",
"cap_linux_immutable",
"cap_net_bind_service",
"cap_net_broadcast",
"cap_net_admin",
"cap_net_raw",
"cap_ipc_lock",
"cap_ipc_owner",
"cap_sys_module",
"cap_sys_rawio",
"cap_sys_chroot",
"cap_sys_ptrace",
"cap_sys_pacct",
"cap_sys_admin",
"cap_sys_boot",
"cap_sys_nice",
"cap_sys_resource",
"cap_sys_time",
"cap_sys_tty_config",
"cap_mknod",
"cap_lease",
"cap_audit_write",
"cap_audit_control",
"cap_setfcap",
"cap_mac_override",
"cap_mac_admin",
"cap_syslog",
"35",
"36+ep"
],
"ansible_system_capabilities_enforced": "True",
"ansible_system_vendor": "VMware, Inc.",
"ansible_uptime_seconds": 56108,
"ansible_user_dir": "/root",
"ansible_user_gecos": "root",
"ansible_user_gid": 0,
"ansible_user_id": "root",
"ansible_user_shell": "/bin/bash",
"ansible_user_uid": 0,
"ansible_userspace_architecture": "x86_64",
"ansible_userspace_bits": "64",
"ansible_virtualization_role": "guest",
"ansible_virtualization_type": "VMware",
"gather_subset": [
"all"
],
"module_setup": true
},
"changed": false
}
I'm terribly stuck for 2 days on this. I have the below list from an api and want to print from tower with something more readable for the enduser. It should be something like a list of switches(infraAccPortP.attributes.name) and if there is a children list then a dict with key of infraHPortS.attributes.name and value infraPortBlk.attributes.fromPort
this is my first attempt at using ansible to retrieve data and manipulate it, I usually just use it to build stuff...thats easier it seems
"result.imdata": [
{
"infraAccPortP": {
"attributes": {
"annotation": "",
"childAction": "",
"descr": "",
"dn": "uni/infra/accportprof-101_102",
"extMngdBy": "",
"lcOwn": "local",
"modTs": "2020-09-10T14:18:01.362+00:00",
"monPolDn": "uni/fabric/monfab-default",
"name": "101_102",
"nameAlias": "",
"ownerKey": "",
"ownerTag": "",
"status": "",
"uid": "15374"
}
}
},
{
"infraAccPortP": {
"attributes": {
"annotation": "",
"childAction": "",
"descr": "",
"dn": "uni/infra/accportprof-101",
"extMngdBy": "",
"lcOwn": "local",
"modTs": "2020-09-10T14:18:01.775+00:00",
"monPolDn": "uni/fabric/monfab-default",
"name": "101",
"nameAlias": "",
"ownerKey": "",
"ownerTag": "",
"status": "",
"uid": "15374"
},
"children": [
{
"infraHPortS": {
"attributes": {
"annotation": "",
"childAction": "",
"descr": "",
"extMngdBy": "",
"lcOwn": "local",
"modTs": "2020-09-16T23:09:40.856+00:00",
"monPolDn": "uni/fabric/monfab-default",
"name": "test",
"nameAlias": "",
"ownerKey": "",
"ownerTag": "",
"rn": "hports-test-typ-range",
"status": "",
"type": "range",
"uid": "23110"
},
"children": [
{
"infraPortBlk": {
"attributes": {
"annotation": "",
"childAction": "",
"descr": "",
"extMngdBy": "",
"fromCard": "1",
"fromPort": "12",
"lcOwn": "local",
"modTs": "2020-09-16T23:09:40.856+00:00",
"monPolDn": "uni/fabric/monfab-default",
"name": "block2",
"nameAlias": "",
"rn": "portblk-block2",
"status": "",
"toCard": "1",
"toPort": "12",
"uid": "23110"
}
}
}
]
}
},
{
"infraHPortS": {
"attributes": {
"annotation": "",
"childAction": "",
"descr": "",
"extMngdBy": "",
"lcOwn": "local",
"modTs": "2020-09-16T13:33:07.108+00:00",
"monPolDn": "uni/fabric/monfab-default",
"name": "101_fex",
"nameAlias": "",
"ownerKey": "",
"ownerTag": "",
"rn": "hports-101_fex-typ-range",
"status": "",
"type": "range",
"uid": "23110"
},
"children": [
{
"infraRsAccBaseGrp": {
"attributes": {
"annotation": "",
"childAction": "",
"extMngdBy": "",
"fexId": "101",
"forceResolve": "yes",
"lcOwn": "local",
"modTs": "2020-09-16T13:33:07.108+00:00",
"monPolDn": "uni/fabric/monfab-default",
"rType": "mo",
"rn": "rsaccBaseGrp",
"state": "formed",
"stateQual": "none",
"status": "",
"tCl": "infraFexBndlGrp",
"tDn": "uni/infra/fexprof-101_fex/fexbundle-101_fex",
"tType": "mo",
"uid": "23110"
}
}
}
]
}
}
]
}
},
{
"infraAccPortP": {
"attributes": {
"annotation": "",
"childAction": "",
"descr": "",
"dn": "uni/infra/accportprof-102",
"extMngdBy": "",
"lcOwn": "local",
"modTs": "2020-09-10T14:18:02.163+00:00",
"monPolDn": "uni/fabric/monfab-default",
"name": "102",
"nameAlias": "",
"ownerKey": "",
"ownerTag": "",
"status": "",
"uid": "15374"
},
"children": [
{
"infraHPortS": {
"attributes": {
"annotation": "",
"childAction": "",
"descr": "",
"extMngdBy": "",
"lcOwn": "local",
"modTs": "2020-09-16T18:30:37.333+00:00",
"monPolDn": "uni/fabric/monfab-default",
"name": "test",
"nameAlias": "",
"ownerKey": "",
"ownerTag": "",
"rn": "hports-test-typ-range",
"status": "",
"type": "range",
"uid": "23110"
},
"children": [
{
"infraPortBlk": {
"attributes": {
"annotation": "",
"childAction": "",
"descr": "",
"extMngdBy": "",
"fromCard": "1",
"fromPort": "7",
"lcOwn": "local",
"modTs": "2020-09-16T18:30:37.333+00:00",
"monPolDn": "uni/fabric/monfab-default",
"name": "block2",
"nameAlias": "",
"rn": "portblk-block2",
"status": "",
"toCard": "1",
"toPort": "7",
"uid": "23110"
}
}
}
]
}
},
{
"infraHPortS": {
"attributes": {
"annotation": "",
"childAction": "",
"descr": "",
"extMngdBy": "",
"lcOwn": "local",
"modTs": "2020-09-11T15:26:44.501+00:00",
"monPolDn": "uni/fabric/monfab-default",
"name": "9k_b25b_1-32",
"nameAlias": "",
"ownerKey": "",
"ownerTag": "",
"rn": "hports-9k_b25b_1-32-typ-range",
"status": "",
"type": "range",
"uid": "23110"
},
"children": [
{
"infraPortBlk": {
"attributes": {
"annotation": "",
"childAction": "",
"descr": "",
"extMngdBy": "",
"fromCard": "1",
"fromPort": "48",
"lcOwn": "local",
"modTs": "2020-09-11T15:26:44.501+00:00",
"monPolDn": "uni/fabric/monfab-default",
"name": "block2",
"nameAlias": "",
"rn": "portblk-block2",
"status": "",
"toCard": "1",
"toPort": "48",
"uid": "23110"
}
}
}
]
}
}
]
}
}
]
}
Expected results would look something like:
switch: 101
ports:
- srvName: test
port: 12
- srvName: test2
port:13
switch: 102
ports:
- srvName: test3
port: 12
- srvName: test4
port:13
Q: "List of switches(infraAccPortP.attributes.name)"
A: The task below
- debug:
msg: "{{ result.imdata|json_query('[].*.*.name')|flatten }}"
gives
msg:
- '101_102'
- '101'
- '102'
How to extract an id like 5105800, 5105801, 5105802 and his quantity 200, 50 , 40 from response Body and reuse it in the request body as show below?
Response Body:
{
"data": {
"callOrders": [
{
"promotionId": null,
"Promotion": null,
"Lines": [
{
"id": 5105800,
"quantity": 200,
"skuId": 85,
"callId": 494281,
"skuBatchId": 587,
"amountDetails": {
"rate": 144.22,
"grossAmount": 32593.72,
"netAmount": 32593.72,
"taxAmount": 3749.72,
"taxableAmount": 28844,
"subTotal": 28844,
"billDiscount": 0,
"tradeDiscount": 0,
"discountAmount": 0,
"promotionDiscount": 0,
"topUpDiscount": 0,
"__typename": "AmountDetail"
},
"rateDetails": {
"rlp": 144.22,
"rlpWithVat": 162.9686,
"netPrice": 144.22,
"netPriceWithVat": 162.9686,
"__typename": "RateDetail"
},
"SKU": {
"id": 85,
"title": "Ariel Oxyblu 500 gm x 48 [82262305]",
"__typename": "SKU"
},
"SKUBatch": {
"priceDetails": {
"rlp": 144.22,
"dlp": 137.35,
"vatPercentage": 0.13,
"mrpSrp": 176,
"mrpStatus": true,
"__typename": "SKUPrice"
},
"batchDetails": {
"batchNumber": "DEFAULT_BATCH",
"__typename": "SKUBatch"
},
"usageDate": {
"manufacture": "0000-00-00",
"expiry": "0000-00-00",
"__typename": "SKUUsage"
},
"updatedAt": "2018-12-01",
"active": true,
"__typename": "SKUBatchRate"
},
"Promotion": {
"id": null,
"title": null,
"type": null,
"scope": null,
"criteria": null,
"__typename": "Promotion"
},
"promotionId": null,
"distributorId": 16,
"__typename": "Line",
"inStock": "INSTOCK",
"freeSku": false,
"focusedSku": true
},
{
"id": 5105801,
"quantity": 50,
"skuId": 82,
"callId": 494281,
"skuBatchId": 551,
"amountDetails": {
"rate": 281.88,
"grossAmount": 15926.22,
"netAmount": 15926.22,
"taxAmount": 1832.22,
"taxableAmount": 14094,
"subTotal": 14094,
"billDiscount": 0,
"tradeDiscount": 0,
"discountAmount": 0,
"promotionDiscount": 0,
"topUpDiscount": 0,
"__typename": "AmountDetail"
},
"rateDetails": {
"rlp": 281.88,
"rlpWithVat": 318.5244,
"netPrice": 281.88,
"netPriceWithVat": 318.5244,
"__typename": "RateDetail"
},
"SKU": {
"id": 82,
"title": "Ariel Oxyblu 1 kg x 24 [82250306]",
"__typename": "SKU"
},
"SKUBatch": {
"priceDetails": {
"rlp": 281.88,
"dlp": 268.45,
"vatPercentage": 0.13,
"mrpSrp": 344,
"mrpStatus": true,
"__typename": "SKUPrice"
},
"batchDetails": {
"batchNumber": "DEFAULT_BATCH",
"__typename": "SKUBatch"
},
"usageDate": {
"manufacture": "0000-00-00",
"expiry": "0000-00-00",
"__typename": "SKUUsage"
},
"updatedAt": "2018-01-31",
"active": true,
"__typename": "SKUBatchRate"
},
"Promotion": {
"id": null,
"title": null,
"type": null,
"scope": null,
"criteria": null,
"__typename": "Promotion"
},
"promotionId": null,
"distributorId": 16,
"__typename": "Line",
"inStock": "INSTOCK",
"freeSku": false,
"focusedSku": true
},
{
"id": 5105802,
"quantity": 40,
"skuId": 769,
"callId": 494281,
"skuBatchId": 733,
"amountDetails": {
"rate": 197.53,
"grossAmount": 8928.356,
"netAmount": 8928.356,
"taxAmount": 1027.156,
"taxableAmount": 7901.2,
"subTotal": 7901.2,
"billDiscount": 0,
"tradeDiscount": 0,
"discountAmount": 0,
"promotionDiscount": 0,
"topUpDiscount": 0,
"__typename": "AmountDetail"
},
"rateDetails": {
"rlp": 197.53,
"rlpWithVat": 223.2089,
"netPrice": 197.53,
"netPriceWithVat": 223.2089,
"__typename": "RateDetail"
},
"SKU": {
"id": 769,
"title": "H&S 2in1 Active Protect 180 ml x 24 [82302894]",
"__typename": "SKU"
},
"SKUBatch": {
"priceDetails": {
"rlp": 197.53,
"dlp": 186.35,
"vatPercentage": 0.13,
"mrpSrp": 250,
"mrpStatus": true,
"__typename": "SKUPrice"
},
"batchDetails": {
"batchNumber": "DEFAULT_BATCH",
"__typename": "SKUBatch"
},
"usageDate": {
"manufacture": "0000-00-00",
"expiry": "0000-00-00",
"__typename": "SKUUsage"
},
"updatedAt": "2019-11-05",
"active": true,
"__typename": "SKUBatchRate"
},
"Promotion": {
"id": null,
"title": null,
"type": null,
"scope": null,
"criteria": null,
"__typename": "Promotion"
},
"promotionId": null,
"distributorId": 16,
"__typename": "Line",
"inStock": "INSTOCK",
"freeSku": false,
"focusedSku": false
}
],
"__typename": "PromotionOrder"
}
]
}
}
Request Body:
{
"operationName": null,
"variables": {
"input": {
"invoiceId": 3683663,
"orderDetails": [
{
"id": 5105800,
"quantity": 200
},
{
"id": 5105801,
"quantity": 50
},
{
"id": 5105802,
"quantity": 40
}
]
},
"type": "CatalogDetail"
},
"query": "mutation ($input: DispatchInput!) {\n dispatchInvoice(input: $input) {\n id\n __typename\n }\n}\n"
}
When you use JavaScript, you could use the following one :)
const responseBody = {
"data": {
"callOrders": [
{
"promotionId": null,
"Promotion": null,
"Lines": [
{
"id": 5105800,
"quantity": 200,
"skuId": 85,
"callId": 494281,
"skuBatchId": 587,
"amountDetails": {
"rate": 144.22,
"grossAmount": 32593.72,
"netAmount": 32593.72,
"taxAmount": 3749.72,
"taxableAmount": 28844,
"subTotal": 28844,
"billDiscount": 0,
"tradeDiscount": 0,
"discountAmount": 0,
"promotionDiscount": 0,
"topUpDiscount": 0,
"__typename": "AmountDetail"
},
"rateDetails": {
"rlp": 144.22,
"rlpWithVat": 162.9686,
"netPrice": 144.22,
"netPriceWithVat": 162.9686,
"__typename": "RateDetail"
},
"SKU": {
"id": 85,
"title": "Ariel Oxyblu 500 gm x 48 [82262305]",
"__typename": "SKU"
},
"SKUBatch": {
"priceDetails": {
"rlp": 144.22,
"dlp": 137.35,
"vatPercentage": 0.13,
"mrpSrp": 176,
"mrpStatus": true,
"__typename": "SKUPrice"
},
"batchDetails": {
"batchNumber": "DEFAULT_BATCH",
"__typename": "SKUBatch"
},
"usageDate": {
"manufacture": "0000-00-00",
"expiry": "0000-00-00",
"__typename": "SKUUsage"
},
"updatedAt": "2018-12-01",
"active": true,
"__typename": "SKUBatchRate"
},
"Promotion": {
"id": null,
"title": null,
"type": null,
"scope": null,
"criteria": null,
"__typename": "Promotion"
},
"promotionId": null,
"distributorId": 16,
"__typename": "Line",
"inStock": "INSTOCK",
"freeSku": false,
"focusedSku": true
},
{
"id": 5105801,
"quantity": 50,
"skuId": 82,
"callId": 494281,
"skuBatchId": 551,
"amountDetails": {
"rate": 281.88,
"grossAmount": 15926.22,
"netAmount": 15926.22,
"taxAmount": 1832.22,
"taxableAmount": 14094,
"subTotal": 14094,
"billDiscount": 0,
"tradeDiscount": 0,
"discountAmount": 0,
"promotionDiscount": 0,
"topUpDiscount": 0,
"__typename": "AmountDetail"
},
"rateDetails": {
"rlp": 281.88,
"rlpWithVat": 318.5244,
"netPrice": 281.88,
"netPriceWithVat": 318.5244,
"__typename": "RateDetail"
},
"SKU": {
"id": 82,
"title": "Ariel Oxyblu 1 kg x 24 [82250306]",
"__typename": "SKU"
},
"SKUBatch": {
"priceDetails": {
"rlp": 281.88,
"dlp": 268.45,
"vatPercentage": 0.13,
"mrpSrp": 344,
"mrpStatus": true,
"__typename": "SKUPrice"
},
"batchDetails": {
"batchNumber": "DEFAULT_BATCH",
"__typename": "SKUBatch"
},
"usageDate": {
"manufacture": "0000-00-00",
"expiry": "0000-00-00",
"__typename": "SKUUsage"
},
"updatedAt": "2018-01-31",
"active": true,
"__typename": "SKUBatchRate"
},
"Promotion": {
"id": null,
"title": null,
"type": null,
"scope": null,
"criteria": null,
"__typename": "Promotion"
},
"promotionId": null,
"distributorId": 16,
"__typename": "Line",
"inStock": "INSTOCK",
"freeSku": false,
"focusedSku": true
},
{
"id": 5105802,
"quantity": 40,
"skuId": 769,
"callId": 494281,
"skuBatchId": 733,
"amountDetails": {
"rate": 197.53,
"grossAmount": 8928.356,
"netAmount": 8928.356,
"taxAmount": 1027.156,
"taxableAmount": 7901.2,
"subTotal": 7901.2,
"billDiscount": 0,
"tradeDiscount": 0,
"discountAmount": 0,
"promotionDiscount": 0,
"topUpDiscount": 0,
"__typename": "AmountDetail"
},
"rateDetails": {
"rlp": 197.53,
"rlpWithVat": 223.2089,
"netPrice": 197.53,
"netPriceWithVat": 223.2089,
"__typename": "RateDetail"
},
"SKU": {
"id": 769,
"title": "H&S 2in1 Active Protect 180 ml x 24 [82302894]",
"__typename": "SKU"
},
"SKUBatch": {
"priceDetails": {
"rlp": 197.53,
"dlp": 186.35,
"vatPercentage": 0.13,
"mrpSrp": 250,
"mrpStatus": true,
"__typename": "SKUPrice"
},
"batchDetails": {
"batchNumber": "DEFAULT_BATCH",
"__typename": "SKUBatch"
},
"usageDate": {
"manufacture": "0000-00-00",
"expiry": "0000-00-00",
"__typename": "SKUUsage"
},
"updatedAt": "2019-11-05",
"active": true,
"__typename": "SKUBatchRate"
},
"Promotion": {
"id": null,
"title": null,
"type": null,
"scope": null,
"criteria": null,
"__typename": "Promotion"
},
"promotionId": null,
"distributorId": 16,
"__typename": "Line",
"inStock": "INSTOCK",
"freeSku": false,
"focusedSku": false
}
],
"__typename": "PromotionOrder"
}
]
}
};
const orderDetails = [];
responseBody.data.callOrders.forEach((entry) => {
entry.Lines.forEach(({ id, quantity }) => {
orderDetails.push({ id, quantity });
})
});
const requestBody = {
"operationName": null,
"variables": {
"input": {
"invoiceId": 3683663,
"orderDetails": orderDetails
},
"type": "CatalogDetail"
},
"query": "mutation ($input: DispatchInput!) {\n dispatchInvoice(input: $input) {\n id\n __typename\n }\n}\n"
};
console.log(requestBody);
Consul user interface doesn't update the services when they change. The problem is that I launch a example.json to marathon and it appear as a service in consul user interface but when I delete that app from marathon, it doesn't delete from the consul UI it is there.
What could it be?
I use ciscocloud/mesos-consul to register mesos apps with consul, works great
{
"id": "/mesos-consul",
"cmd": null,
"cpus": 0.33,
"mem": 128,
"disk": 0,
"instances": 1,
"container": {
"type": "DOCKER",
"volumes": [],
"docker": {
"image": "ciscocloud/mesos-consul",
"network": "BRIDGE",
"portMappings": [
{
"containerPort": 0,
"hostPort": 0,
"servicePort": 10004,
"protocol": "tcp",
"labels": {}
}
],
"privileged": false,
"parameters": [],
"forcePullImage": false
}
},
"portDefinitions": [
{
"port": 10004,
"protocol": "tcp",
"labels": {}
}
],
"args": [
"--zk=zk://zookeeper-hostname:2181/mesos",
"--mesos-ip-order=mesos",
"--log-level=err",
"--refresh=1s"
]
}