python,command-line,centos,fabric,scp
First, elaborating on the security hazards of doing this, it's very easy to view command line arguments just by running ps -ww -fp <pid>. This vulnerability is why scp doesn't allow the password to be passed in on the command line. So make sure that you're okay with the fact...
I'm not sure what your end goal is with this code snippet. If you're trying to isolate the effects of modifying env by having it in a class, that's not going to work. It's a module level global in fabric and no matter where you modify it (by assignment like...
EDIT: Original answer corrected The fabric.main.main() function automatically adds .py to the end of supplied fabfile locations (see https://github.com/fabric/fabric/blob/master/fabric/main.py#L93). Unfortunately that function also uses Python's import machinery to load the file so it has to look like a module or package. Without reimplementing much of the fabric.main module I don't...
You have not imported lcd. Add the following to the top of your file: from fabric.context_managers import lcd ...
As per the official tutorial, the error specifies that you have not specified a connection in your fabfile for it to deploy. Please check here. Other than that, in the cd method(used along side the with statement), use full path like with cd('/path/to/directory/myApp') rather than just the 'myApp'. Even if...
I figured out finally there is an issue with SSH and need to pass pty=False flag. run("sshfs -o reconnect -C -o workaround=all localhost:/home/test/ /mnt",pty=False) ...
logging.exception will output the traceback after you catch the error: import logging try: 1/0 except Exception as e: logging.exception(e) ERROR:root:division by zero Traceback (most recent call last): File "/home/padraic/Dropbox/python/py3/size.py", line 105, in <module> 1/0 ZeroDivisionError: division by zero Process finished with exit code 0 If you look at the failure-handling...
This isn't a syntax error, rather the python code is still being executed on your machine and not the remote machine. So calling os.path.getsize is checking the path size on your local machine (where it does not exist). Instead you need to use fabric to execute shell commands on the...
python,python-2.7,ssh,fabric,python-2.x
Your solution is correct, use execute to run task programmatically. The error TypeError: hostname() takes no arguments (1 given) means your function does not accept argument, which is my_env. Just modify to: def hostname(my_env): return run('hostname') And it will work....
python,deployment,web-deployment,fabric,fab
You can use env.skip_bad_hosts = True option. Here is documentation about it: http://docs.fabfile.org/en/latest/usage/env.html#skip-bad-hosts...
You're certainly trying to use the rights of sudo in a script launched from your simple-user-rights. So, you must launch the script using the sudo command.
TL;DR; Download dropbox.com/s/cb5fro1rv... - thanks Arash Rahimi Navigate to your SDK tools sn -Vr Microsoft.Cloud.Common.AzureStorage.dll gacutil /i Microsoft.Cloud.Common.AzureStorage.dll This issue was caused by installing the Visual Studio 2015 RC. Thankfully someone else has already experienced this and an answer has been posted. Please see this answer on How do I...
python,shell,amazon-web-services,fabric
Use it with run('nohup PATH_TO_JMETER/Jmetercommand & sleep 5; exit 0) ...
Using Fabric==1.8.3: Your code with added imports and managing docstring for tasks: fabfile.py: from fabric.api import * from fabric.tasks import Task class BaseConfig(Task): """BaseConfig task docstring""" def run(self): """BaseConfig task docstring for `run` method""" env.env = self.name env.user = 'serafeim' env.role = self.name puts("Using {0} configuration with user {1} at...
solved the problem by removing folders: ~ / Library / Caches / com.crashlytics.data ~ / Library / Caches / com.crashlytics.mac
python,amazon-web-services,ssh,fabric,paramiko
So, I found the solution to my question. It was just a stupid thing not to check my pem file, which was secured with a passphrase. The python file can be named anything, as far as it has an execute method - and it is executed just like a normal...
ios,fabric,beta,crashlytics-beta
The only other option is an Enterprise account from Apple, which will let you create an In House provisioning profile which lets people run your app without having to add the UUID. However, there are limitations. Apple's Enterprise Dev Program homepage.
linux,error-handling,output,warnings,fabric
I found the solution, it is with "stderr" I didn't know about it from fabric.api import local, env env.warn_only = True # if you want to ignore exceptions and handle them yurself command = "your command" x = local(command, capture=True) if(x.stderr != ""): error = "On %s: %s" %(command, x.stderr)...
android,ios,migration,fabric,crashlytics
Alex from Fabric here. Absolutely possible. Once you upgrade to Fabric your original Crashlytics apps will continue to work normally and you can view them via your fabric.io dashboard. You can then migrate apps to the updated Fabric SDKs at your convenience.
ios,objective-c,twitter,fabric
Alex from Fabric here. To use different Twitter API keys or API keys generated on apps.twitter.com, you're declaring it correctly in your code above. It sounds like you may not have fully onboarded your app through the Fabric app, and required entries, like the Fabric APIKey, are missing from your...
One way is to use path parameters with git. Parameters are verified with git version 1.7.9.5. local('git --git-dir ' + branch_name + '/.git --work-tree ' + branch_name + ' checkout HEAD -b ' + branch_name) ...
a = sudo("ls -l my_filename | awk '{print $11}'", capture=True ) ...
There are plans to introduce a feature for this in fabric 2. With fabric 1 you could create a subclass of a custom class.
Found a solution, edited in the answer to the question above as 'EDIT 2' I didn't realize there was a cd context manager in Fabric, so using that I found a solution: from fabric.api import cd with cd('/myfolder/name with spaces/files/'): sudo('rm -f *.pyc') I also discovered a separate issue: using...
python,windows,fabric,ssh-keys
In Cygwin_Terminal the path to the C: drive is /cygdrive/c/ or the path you would need to use inside cygwin would be '/cygdrive/c/Program\ Files\ \(x86\)/WinSCP/SSH_Key.ppk' also you will probably also need to export the ppk to an openssh key using puttygen so openssh can read the file....
There are two ways to do this: Set env.hosts at the module level, so it gets set when the fabfile is imported Chain modules to set the env variable. In your case, the second one can be accomplished by removing the line prod() from collectstatic and instead invoking fabric like...
Not sure what you mean by "another tab" but I think you get stuck because python waits for the process to complete which is in the infinite loop. You need to detach the process from python after starting it. If I want Firefox to open another page in a separate...
python,server,wait,fabric,remote-server
One way to do this is to change the way you're calling remote_function, and use Fabric execute instead. from fabric.api import execute local_function_1() execute(remote_function) local_function_2() execute should block until the tasks complete. For more info, see Intelligently executing tasks with execute....
What I found was that I had to revert to both paramiko 1.10 and fabric 1.8.1, and then also comment out lines 56 and 57 of /usr/lib64/python2.6/site-packages/Crypto/Util/number.py per https://github.com/ansible/ansible/issues/276 In summary: pip uninstall fabric paramiko pip install paramiko==1.10 pip install fabric==1.8.1 Then: vim /usr/lib64/python2.6/site-packages/Crypto/Util/number.py And comment out lines 56 and...
I'm not sure you can do this easily with fabric. With paramiko you can do something like: ssh = paramiko.SSHClient() //auth stuff //ssh.connect() sftp = ssh.open_sftp() with sftp.file('/home/ubuntu/iris.csv','r') as f: for i in range(5): print(f.readline()) ...
It looks like your fabric settings are correct with the use of variables. I was able to use the code you provided to connect to my Ubuntu VM. I am wondering if you are having a connection issue due to the amazon Instance not being fully booted and ready for...
I managed to do this with the runs_once decorator and execute function. The build task is now decorated with runs_once and every task that depends on build, e.g. deploy, will do execute(build) at the beginning. This will execute the build task or silently fail if it was already executed (thanks...
python,fabric,supervisord,supervisor
This is rather about using supervisorctl than using fabric Avoid fab calls to commands, requiring user interaction Fabric does one-shot calls to commands and then returns. Shall be no long term activity on console. The solution for your problem is not to enter interactive mode (which awaits some further input),...
I defined the following task in my fabfile.py: @task def ssh(): env.forward_agent = True run('ssh [email protected] -p 49222') with settings(output_prefix=False, forward_agent=True): run('ssh [email protected] -p 49222') And in the remote servers sshd_config I needed to set: AllowAgentForwarding yes In addition, the output_prefix=False is useful to remove the [hostname] run: prefix that...
Change execute('start') to execute(start). I didn't find out why pass a taskname to execute did not work, but there is a workaround: import fabfile execute(getattr(fabfile, 'start')) Update: After reading a bit code and doing some test of fabric, I think execute('task_name') can only be used when fabric tasks are loaded....
python,shell,amazon-ec2,fabric
This is likey reated to TTY issues, and/or that you're attempting to background a process. Both of these are discussed in the FAQ under these two headings: http://www.fabfile.org/faq.html#init-scripts-don-t-work http://www.fabfile.org/faq.html#why-can-t-i-run-programs-in-the-background-with-it-makes-fabric-hang Try making the sudo like this: sudo('nohup ./dbserver &', user=root, pty=False) ...
I am not sure if I did understand what you want. I will assume, that you want to run a task on h1, wait for the result and use this result as an input for tasks on h2 and h3. If you want something else, forget this answer (and reword...
I have learned that a single fab file is enough for a project. Instead, it is best to have a single fab file that defines multiple functions that each make use of a different server. Fabric documentation offers a few ways to do this, depending on the specific needs of...
Turns out I just forgot to add quotes around the URL. I added them and it works fine. Final code would be something like: sudo('curl -o /tmp/test.gz "{}"'.format(url)) ...
amazon-web-services,amazon-ec2,load-testing,boto,fabric
The problem is, I think, this line in your boto config file: ec2_region_endpoint = ec2-54-148-72-140.us-west-2.compute.amazonaws.com This is telling boto that it should try to use this hostname to make EC2 requests but this appears to be the hostname of an EC2 instance which will not be able to reply to...
Turned out being a matter of redirecting stdin from parent to child process. See below: Perl's backticks/system giving "tcsetattr: Input/output error" Access STDIN of child process without capturing STDOUT or STDERR This is the solution: read_io, write_io = IO.pipe job1 = fork do write_io.close STDIN.reopen(read_io) puts `fab example` end Process.detach(job1)...
Don't roll this by hand if you don't really need to. Fabric has the parallel execution built-in using multiprocessing, e.g. using the -P CLI flag: $ fab -H web1,web2,web3 -P driver See Fabric docs on parallel execution for all the options. As for the threading support, see FAQ - Is...
I resolved the problem. I put my code in applicationDidFinishLaunching(application: UIApplication) instead of func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?)
Oh, my mistake. I had foolishly set env.sudo_user to my deploy user testuser, thinking that it was specifying the invoking user on remote. In fact, it was specifying the target user, and I was attempting to sudo into myself. Whoops.
You can first push your myfile.py to the remote machine using fabric.operations.put and then run the script like you've attempted to. But make sure the path to your script is either an absolute path or relative to the current directory from which the remote commands are being executed, this can...
I have a glance of your code, since you don't need to print out anything in sscounter.sh, there is one quick solution for the hanging issue: changing ( $DIR/sscounter.sh ) & to ( $DIR/sscounter.sh ) >/dev/null 2>&1 &. When you did not redirect the stdout, fabric will wait for it...