RabbitMQ could not create a exchange,Erlang error {:undef, [{:rabbit_exchange - rabbitmq

RabbitMQ 3.8.17 / Erlang 24.0.2 / Mac Pro Big Sur
My command
rabbitmqctl eval 'rabbit_exchange:declare({resource, <<"vhost1">>, exchange, <<"exchange_test">>}, topic, true, false, false, []).'
Error message:
Error:
{:undef, [{:rabbit_exchange, :declare, [{:resource, "vhost1", :exchange, "exchange_test"}, :topic, true, false, false, []], []}, {:erl_eval, :do_apply, 6, [file: 'erl_eval.erl', line: 685]}, {:erl_eval, :exprs, 2, []}]}
Could you please tell me what error this could be?

you should not use the internals to interact with RabbitMQ.
There are several ready clients to do that
This is the right command to use btw:
rabbitmqctl eval 'rabbit_exchange:declare({resource,<<"/">>,exchange,<<"myexchange">>}, fanout, false, false, false, [],<<"rmqinternal">>).'

Related

How do I test Expo application without building apk with appium?

I try to make some tests on my Expo application but I can't launch it with appium,
Here is my capabilities:
const capabilities = {
platformName: 'android',
deviceName: 'Emulator1',
automationName: 'UiAutomator2',
pkg: 'host.exp.exponent',
intentAction: 'android.intent.action.VIEW',
activity: 'host.exp.exponent.experience.HomeActivity',
appWaitForLaunch: true,
path: '/wd/',
port: 4723,
};
I got this :
ERROR webdriver: Request failed with status 404 due to unknown command: The requested resource could not be found, or a request was received using an HTTP method that is not supported by the mapped resource
[0-0] 2021-02-18T12:34:11.688Z ERROR webdriver: unknown command: The requested resource could not be found, or a request was received using an HTTP method that is not supported by the mapped resource
at Object.getErrorFromResponseBody (/Users/kanka/Desktop/projects/expo-tests/node_modules/webdriver/build/utils.js:189:12)
at WebDriverRequest._request (/Users/kanka/Desktop/projects/expo-tests/node_modules/webdriver/build/request.js:168:31)
at process._tickCallback (internal/process/next_tick.js:68:7)
[0-0] 2021-02-18T12:34:11.690Z ERROR #wdio/runner: Error: Failed to create session.
The requested resource could not be found, or a request was received using an HTTP method that is not supported by the mapped resource
at Object.startWebDriverSession (/Users/kanka/Desktop/projects/expo-tests/node_modules/webdriver/build/utils.js:68:15)
at process._tickCallback (internal/process/next_tick.js:68:7)
2021-02-18T12:34:11.810Z DEBUG #wdio/local-runner: Runner 0-0 finished with exit code 1
[0-0] FAILED in undefined - /tests/App.test.js
2021-02-18T12:34:11.811Z INFO #wdio/cli:launcher: Run onComplete hook
Spec Files: 0 passed, 1 failed, 1 total (100% completed) in 00:00:01
If you are using "webdriverio": "^7.0.7" package: try updating your configuration file like this :
wdio.conf.js
exports.config = {
services: ['appium'],
port: 4723,
path: '/wd/hub/',
hostname: 'localhost',
protocol: 'http',
specs: [
'./test/specs/**/*.js',
],
maxInstances: 1,
capabilities: [{
platformName: 'android',
deviceName: 'test', // Change to the name of the AVD you're using
automationName: 'UiAutomator2',
appPackage: 'host.exp.exponent',
appActivity: 'host.exp.exponent.experience.HomeActivity',
appWaitActivity: 'host.exp.exponent.experience.HomeActivity',
intentAction: 'android.intent.action.MAIN',
appWaitForLaunch: true,
newCommandTimeout: 180,
uiautomator2ServerInstallTimeout: 100000,
adbExecTimeout: 1000000,
skipLogcatCapture: true,
}],
logLevel: 'trace',
bail: 0,
waitforTimeout: 10000,
connectionRetryTimeout: 1200000,
connectionRetryCount: 3,
framework: 'mocha',
reporters: ['spec'],
mochaOpts: {
ui: 'bdd',
timeout: 180000,
},
};
path port are not in capabilities array.

Running "ansible-playbook playbook.yml" outputs fatal: [localhost]: FAILED

Following the ansible 2-org-network example tutorial, when running "ansible-playbook playbook.yml" command, this outputs
"TASK [ibm.blockchain_platform_manager : Authenticate to IBM Blockchain Platform service] *****************************************************
fatal: [localhost]: FAILED! => {"changed": false, "connection": "close", "content": "{\"context\":{\"requestId\":\"3aed45737c8d4cc7a3a52b03cfbf7e64\",\"requestType\":\"incoming.Identity_Token\",\"userAgent\":\"ansible-httpget\",\"url\":\"https://iam.cloud.ibm.com\",\"instanceId\":\"iamid-5.2-7439-f51ff7a-6488f4d469-jxdn5\",\"threadId\":\"f61a\",\"host\":\"iamid-5.2-7439-f51ff7a-6488f4d469-jxdn5\",\"startTime\":\"15.02.2020 21:04:28:625 GMT\",\"endTime\":\"01.01.1970 00:00:00:000 GMT\",\"elapsedTime\":\"0\",\"locale\":\"en_US\",\"clusterName\":\"iam-id-prams03-igyr\"},\"errorCode\":\"BXNIM0415E\",\"errorMessage\":\"Provided API key could not be found\"}", "content_language": "en-US", "content_length": "517", "content_type": "application/json", "date": "Sat, 15 Feb 2020 21:04:28 GMT", "elapsed": 0, "json": {"context": {"clusterName": "iam-id-prams03-igyr", "elapsedTime": "0", "endTime": "01.01.1970 00:00:00:000 GMT", "host": "iamid-5.2-7439-f51ff7a-6488f4d469-jxdn5", "instanceId": "iamid-5.2-7439-f51ff7a-6488f4d469-jxdn5", "locale": "en_US", "requestId": "3aed45737c8d4cc7a3a52b03cfbf7e64", "requestType": "incoming.Identity_Token", "startTime": "15.02.2020 21:04:28:625 GMT", "threadId": "f61a", "url": "https://iam.cloud.ibm.com", "userAgent": "ansible-httpget"}, "errorCode": "BXNIM0415E", "errorMessage": "Provided API key could not be found"}, "msg": "Status code was 400 and not [200]: HTTP Error 400: Bad Request", "redirected": false, "set_cookie": "sessioncookie=76599c5849373452d151007c6314be2a; Path=/; Secure; HttpOnly", "status": 400, "transaction_id": "3aed45737c8d4cc7a3a52b03cfbf7e64", "url": "https://iam.cloud.ibm.com/identity/token", "x_powered_by": "Servlet/3.1"}
PLAY RECAP ***********************************************************************************************************************************
localhost : ok=4 changed=0 unreachable=0 failed=1 skipped=0 rescued=0 ignored=0
"
I don't know if this an error, but a node file should be created but it's not. a screenshot of the output is attached
Edit: I'm using ibm blockchain platform vscode extension. changed the infrastructure.type from "saas" to "software" while the previous error is gone another one apperead "I'm using the ibm platform extension on vs code. changed the infrastructre.type from "saas" to "software" in the "playbook.yaml" file, that error is gone but a new appeared
"fatal: [localhost]: FAILED! => {"changed": false, "content": "", "elapsed": 0, "msg": "Status code was -1 and not [200]: Request failed: ", "redirected": false, "status": -1, "url": "https://ibp-console.example.org:32000/ak/api/v1/components?skip_cache=yes"}
PLAY RECAP ***********************************************************************************************************************************
localhost : ok=11 changed=3 unreachable=0 failed=1 skipped=0 rescued=0 ignored=0
"
The ansible role provides support for 3 options, saas, software and docker.
saas refers to IBM Blockchain platform in the cloud, ie the software as a service offering in IBM Cloud, so you need to have provisioned IBM Blockchain platform on the IBM Cloud for this option.
software refers to IBM Blockchain platform software which you need to purchase from IBM and have it deployed.
docker refers to a local deployment on your machine using docker of the Open Source Hyperledger images it creates a local fabric network on your machine.
I'm guessing that you would want to use the docker option.

How ansible serialise commands to execute on remote host?

Without an agent on target host, Ansible is able to perform tasks like for example: adding a user(-m user).
To understand this, I read this article, which says:
"Ansible works by connecting to your nodes and pushing out small programs, called "Ansible modules" to them. These programs are written to be resource models of the desired state of the system."
To understand this point, my interpretation is, user module is python module located in control server and this module is serialized on wire to target host, after running ansible command with -m user option.
Does ansible serialize these programs(user source code) via ssh? to execute on remote host...
Does this serialization involves ssh agent forwarding technique?
When ansible executes a module in your playbook, it serializes the code it needs to run with the encountered parameters into a local python files named <local user home>/.ansible/tmp/ansible-local-<current-run-hash>/tmp<some-other-hash>.
This file is uploaded to the remote host in <remote_user home dir>/.ansible/tmp/ansible-tmp-<current-run-hashed-id>/AnsiballZ_<module_name>.py using the declared connection for this host (ssh, docker, local...).
The python file is executed on the remote host through that connection, result is fetched back to the local machine and the file is cleaned-up.
You can see exactly how all this is executed using the -vvv option to ansible-playbook (or ansible if you are sending ad-hoc commands). Here is an example of running the stat module against a docker host on my local machine.
The task:
- name: Check if SystemD service is installed
stat:
path: /etc/systemd/system/nexus.service
register: nexus_systemd_service_file
Running with -vvv. The file copy to remote starts at line 7.
TASK [nexus3-oss : Check if SystemD service is installed] **********************
task path: /projects/ansible/nexus3-oss/tasks/main.yml:13
<nexus3-oss-debian-stretch> ESTABLISH DOCKER CONNECTION FOR USER: root
<nexus3-oss-debian-stretch> EXEC ['/usr/bin/docker', b'exec', b'-i', 'nexus3-oss-debian-stretch', '/bin/sh', '-c', "/bin/sh -c 'echo ~ && sleep 0'"]
<nexus3-oss-debian-stretch> EXEC ['/usr/bin/docker', b'exec', b'-i', 'nexus3-oss-debian-stretch', '/bin/sh', '-c', '/bin/sh -c \'( umask 77 && mkdir -p "` echo /home/deployuser/.ansible/tmp/ansible-tmp-1555848182.1761565-31974482443721 `" && echo ansible-tmp-1555848182.1761565-31974482443721="` echo /deployuser/.ansible/tmp/ansible-tmp-1555848182.1761565-31974482443721 `" ) && sleep 0\'']
Using module file /home/localuser/.local/lib/python3.6/site-packages/ansible/modules/files/stat.py
<nexus3-oss-debian-stretch> PUT /home/localuser/.ansible/tmp/ansible-local-30458wt820190/tmpq2vjarrv TO /home/deployuser/.ansible/tmp/ansible-tmp-1555848182.1761565-31974482443721/AnsiballZ_stat.py
<nexus3-oss-debian-stretch> EXEC ['/usr/bin/docker', b'exec', b'-i', 'nexus3-oss-debian-stretch', '/bin/sh', '-c', "/bin/sh -c 'chmod u+x /home/deployuser/.ansible/tmp/ansible-tmp-1555848182.1761565-31974482443721/ /home/deployuser/.ansible/tmp/ansible-tmp-1555848182.1761565-31974482443721/AnsiballZ_stat.py && sleep 0'"]
<nexus3-oss-debian-stretch> EXEC ['/usr/bin/docker', b'exec', b'-i', 'nexus3-oss-debian-stretch', '/bin/sh', '-c', '/bin/sh -c \'http_proxy=\'"\'"\'\'"\'"\' https_proxy=\'"\'"\'\'"\'"\' no_proxy=\'"\'"\'\'"\'"\' /usr/bin/python /home/deployuser/.ansible/tmp/ansible-tmp-1555848182.1761565-31974482443721/AnsiballZ_stat.py && sleep 0\'']
<nexus3-oss-debian-stretch> EXEC ['/usr/bin/docker', b'exec', b'-i', 'nexus3-oss-debian-stretch', '/bin/sh', '-c', "/bin/sh -c 'rm -f -r /home/deployuser/.ansible/tmp/ansible-tmp-1555848182.1761565-31974482443721/ > /dev/null 2>&1 && sleep 0'"]
ok: [nexus3-oss-debian-stretch] => {
"changed": false,
"invocation": {
"module_args": {
"checksum_algorithm": "sha1",
"follow": false,
"get_attributes": true,
"get_checksum": true,
"get_md5": null,
"get_mime": true,
"path": "/etc/systemd/system/nexus.service"
}
},
"stat": {
"atime": 1555848116.0796735,
"attr_flags": "",
"attributes": [],
"block_size": 4096,
"blocks": 8,
"charset": "us-ascii",
"checksum": "f1de2c2bc91adc019e58f83a29c970d1d79d5cc9",
"ctime": 1553622777.8884165,
"dev": 77,
"device_type": 0,
"executable": false,
"exists": true,
"gid": 0,
"gr_name": "root",
"inode": 22997,
"isblk": false,
"ischr": false,
"isdir": false,
"isfifo": false,
"isgid": false,
"islnk": false,
"isreg": true,
"issock": false,
"isuid": false,
"mimetype": "text/plain",
"mode": "0644",
"mtime": 1553622777.3485653,
"nlink": 1,
"path": "/etc/systemd/system/nexus.service",
"pw_name": "root",
"readable": true,
"rgrp": true,
"roth": true,
"rusr": true,
"size": 248,
"uid": 0,
"version": "687353",
"wgrp": false,
"woth": false,
"writeable": true,
"wusr": true,
"xgrp": false,
"xoth": false,
"xusr": false
}
}

Why is Ansible still able to connect node without ssh

I created two ubuntu docker containers one with control node and another with slave. I ran
ansible all -m service -a "name=ssh state=stopped"
and it shows
172.18.0.3 | CHANGED => {
"changed": true,
"name": "ssh",
"status": {
"enabled": {
"changed": false,
"rc": null,
"stderr": null,
"stdout": null
},
"stopped": {
"changed": true,
"rc": 0,
"stderr": "",
"stdout": " * Stopping OpenBSD Secure Shell server sshd\n ...done.\n"
}
}
}
Then I tried to ssh manually it failed because the openssh server has stopped which is fine. Then I ran another ansible command to start it.
# ansible all -m service -a "name=ssh state=started"
172.18.0.3 | CHANGED => {
"changed": true,
"name": "ssh",
"status": {
"enabled": {
"changed": false,
"rc": null,
"stderr": null,
"stdout": null
},
"started": {
"changed": true,
"rc": 0,
"stderr": "",
"stdout": " * Starting OpenBSD Secure Shell server sshd\n ...done.\n"
}
}
}
I am quiet amazed how was ansible able to connect to the node when I have already stopped the ssh service of the node ? Is there some alternative method that ansible is connecting to node other than ssh?
Ansible can connect to targets through a variety of protocols.
Take a look at the connection plugins list
In your case, for Docker containers, it uses the Docker API.

How do I get the Aurelia-cli to provide a stack trace on a gulp plugin error?

To any Aurelia CLI pros out there:
I've successfully got karma code coverage setup and mapping the bundled output back to my typescript sources, but the karma plugin is throwing an error when generating the output. See here:
{ uid: 0,
name: 'unit',
branch: false,
error:
{ [TypeError: Cannot read property 'split' of null]
domain:
Domain {
domain: null,
_events: {},
_eventsCount: 0,
_maxListeners: undefined,
members: [] },
domainThrown: true },
duration: [ 1, 611956616 ],
time: 1474556751202 }
{ [TypeError: Cannot read property 'split' of null]
domain:
Domain {
domain: null,
_events: {},
_eventsCount: 0,
_maxListeners: undefined,
members: [] },
domainThrown: true }
How do I tell the CLI to give me the stack trace so that I can go and fix the issue in the plugin?
Here is a project that demonstrates the problem:
https://github.com/Roustalski/aurelia-typescript-coverage
Follow the instructions in the README.
You can actually step through CLI: How to debug Aurelia CLI
TL:DR Using vscode you can setup launch target for node and execute cli with debugger attached.