Warning: sudo() encountered an error (return code 1) while executing: Fabric - fabric

I'm new to fabric. I'm trying to check if setkey is installed in the remote machine. For that I'm just trying to check its version number and if it returns an error then it will install the required package. The following is the code
with settings(hide('stdout'), warn_only=True):
out = sudo('setkey -V', shell=False);
if out.failed:
print(red("* Setkey not installed. Installing"))
sudo(setkey_install)
However I'm getting a warning
Warning: sudo() encountered an error (return code 1) while executing 'setkey -V'
What could be the reason for this? Is there any other way to check if a package is installed?

I would use the *nix command which to return the location of the setkey (or nothing if it doesn't exist), with something like this:
with settings(hide('stdout'), warn_only=True):
if not run('which setkey'):
print(red("* Setkey not installed. Installing..."))
sudo(setkey_install)
Since run returns the output of the command it's given you should be able to use the not operator on it like this.

Related

How can I solve this error in OMNest 5.5.1?

I get the following error:
Exception occurred executing command line.
Cannot run program "C:/OMNEST-5.5.1/samples/enera/lteAdvanced/enera.exe" (in directory "C:\OMNEST-5.5.1\samples\enera\lte"): CreateProcess error=2, The System cannot find the file.
I already built the project many times. I have tried to make a simplier already given example from omnet just to check if this is working. It is working. But if I copy this example in my Project it also doesn't work, so there is sth wrong with my Project file. But it seems to be correct. I just have one Connection and kept it really really simple. But it doesn't work. I have installed Omnest and inet correctly.
The most likely cause is that the EXE file cannot find the omnet++ dynamic libraries it tries the load. And the most likely reason is that you are trying to execute the executable from a CMD prompt instead of from the shell provided by the mingwenv.cmd script.
Everything you do in OMNeT++ (including starting the simulations) must be run from the mingwenv shell.

Call to mongocxx::instance returns "mongoc: Failed to initialize OpenSSL"

I have a very simple MongoDB application that connects to a MongoDB database and works fine.
I've then added the connectivity calls to a large, complex, legacy application and when I call:
mongocxx::instance (i.e. the first MongoDB library call)
I get the following response:
2018/08/16 10:20:59.0499: [16856]: ERROR: mongoc: Failed to initialize OpenSSL.
It appears that the low-level call to SSL_CTX_new within the MongoDB C library is returning a null pointer.
I'm not too sure why this is happening. I've even gone so far as recompiling and linking my simple MongoDB app against all of the libraries that the large legacy app uses (calls to ldd are now identical) but the simple app is still working fine.
This is using the following MongoDB drivers:
mongo-c-driver-1.11.0
mongo-cxx-driver-r3.3.0
Compiled and run on RHEL7 box (7.4) using OpenSSL 1.1.0.
Any suggestions?
I was just in trouble with the same error.
It solved it by changing the option of cmake.
In this way, setting an option, it will work.
cmake -DENABLE_SSL=OFF ..
In the following method, OpenSSL initialization error occurs.
cmake -DENABLE_AUTOMATIC_INIT_AND_CLEANUP = NO
I'd like to know how to prevent initialization errors with "ENABLE_AUTOMATIC_INIT_AND_CLEANUP".
https://github.com/mongodb/mongo-c-driver/blob/r1.10/NEWS#L935
https://github.com/mongodb/mongo-c-driver/blob/2edd3b2a91171a5da88e9282ffb6a3efbbc2bd91/src/libmongoc/CMakeLists.txt#L225
This problem was solved by make of OpenSSL.
Why 'apt-get install openssl' did not install last version of OpenSSL?
I used the following.
openssl-1.1.0f
mongo-c-driver-1.10.1
mongo-cxx-driver-r3.3.0

Error creating Java Virtual Machine

I am just trying to download all the Railscasts using this, which I found on Github https://github.com/bayan/railscast-downloader
I don't know anything about Clojure or the Java Virtual Machine, but when I try to run the railscast-download.clj script, I run into this issue on the command line
myname$ clj railscast-download.clj -rss http://railscasts.com/subscriptions/
cPMkaVfRUwbK1foKpHupsA/episodes.rss -type mp4
Unrecognized option: -ccp
Error: Could not create the Java Virtual Machine.
Error: A fatal exception has occurred. Program will exit.
What does 'Unrecognized option: -ccp' mean? How do I fix it?
I did follow all of the previous instructions (the prerequisites), and everything up until this point seemed to work
Did you perhaps put "-ccp" instead of "-cp" in your alias?

Imunnity Debugger PyCommands: failed to locate main function

relatively simple question here. I recently installed immunity debugger for the PyCommands feature, however whenever I try to write my own pycommand and execute it in immunity, it gives me the error message "failed to locate main function". Odd, considering I did write a main(args) function. The code I tried to use was as follows:
#!usr/bin/env python
from immlib import *
def main(args):
imm = Debugger()
return "[*] Command successfully executed."
I cannot see what is wrong with this, as I have only been following the example scripts included with Immunity. I have also checked !list which shows my command on a list of available commands, but when I try to run it from there, it still throws the error. Does anyone know why this might be?
OS: Windows XP SP3 x86 (VMWare)
Python 2.7.3
So I just figured out my own problem. The name of the command was 'test'. I'm guessing test was a reserved word or something, because I renamed it to mycommand and got the desired output. If anyone else comes across this issue with immunity, I hope this helps.

Rcpp error, learning Rcpp and C++ on mac

I've decided to start learning Rcpp and C++ so I can make aspects of my R code faster. For a start I'm using the tutorial hadley has in the devtools wiki. I have a c++ compiler on this machine in that it's a mac and I have xcode installed on it - I'm told that puts the c++ compiler on the machine. I try to run the first example:
cppFunction('
int one(){
return 1;
}
')
However, what happens is:
sh: make: command not found
Error in sourceCpp(code = code, env = env, rebuild = rebuild, showOutput = showOutput, :
Error 1 occurred building shared library.
I'm guessing I have a setup issue, but what to do I'm not sure. For a general C++ knowlege I've started reading Absolute C++ by Savitch, which so far does not actually tell you anything about setting up a machine with compiler etc, because you're instructed to use something called MyProgrammingLab which just tells you if you got the answer right or not and gives output, you don't go through the compilation or anything like that.
Thanks,
Ben W.
Errors of the type sh: foo: command not found are pretty obvious. You are lacking the make command. Install it, and try again. Or if Xcode installs it outside of the path, add it to the path.