fabric

gzip python module is giving empty bytes

gzip python module is giving empty bytes Question: I copied one .gz file to a remote machine using fabric. When I tried to read the same remote file, empty bytes are getting displayed. Below is the python code I used to read the zip file from remote machine. try: fabric_connection = Connection(host = host_name, connect_kwargs …

Total answers: 1

fabric how did it to work and using sudo (connection class) method?

fabric how did it to work and using sudo (connection class) method? Question: Am like to figure out in Fabric https://www.fabfile.org/index.html , framework to run commands on the remote machine via SSH. Via Getting Started, I could do to connect, running commands via user with connected by; and run commands with sudo by the Responder. …

Total answers: 1

Automate `lxc-attach` through ssh with Python

Automate `lxc-attach` through ssh with Python Question: Question: How do I automate this process, and include all of the password prompts? Machine 1> ssh user2@machine2 password: Machine 2> lxc-attach -n 0x1000 Container> ssh user3@machine3 password: Machine 3> get_temperature.sh temperature is 65C Background: I am running some automated scripts on a computer (Machine 1) with several …

Total answers: 1

How to get back raw binary output from python fabric remote command?

How to get back raw binary output from python fabric remote command? Question: I am using Python 3.8.10 and fabric 2.7.0. I have a Connection to a remote host. I am executing a command such as follows: resObj = connection.run("cat /usr/bin/binaryFile") So in theory the bytes of /usr/bin/binaryFile are getting pumped into stdout but I …

Total answers: 1

Executing command using "su -l" in SSH using Python

Executing command using "su -l" in SSH using Python Question: I use a friends server that allows only one user to be logged from SSH, so normally I just log in as that user and then do su -l myuser to change accounts. I wanted to automate some boring stuff using Python, but I ran …

Total answers: 1

How to read fabric(python) confirmation in jenkins job execution

How to read fabric(python) confirmation in jenkins job execution Question: We have a python deployment script for our application and we use fabric package to ask user for the confirmation to proceed further (if user fixes manually or want to ignore) with any issues during the deployment. question=”Failure encountered during deployment.Would you like to continue?” …

Total answers: 1

how to debug python fabric using pycharm

how to debug python fabric using pycharm Question: There are some posts on SO and tell me to use fab-script.py as startup script for pycharm. It’s exactly what I used before. Now when I upgrade fabric to latest version, fab-script disappeared, and only fab.exe left there. I tried a lot of other ways, but still …

Total answers: 3

Python import error :No module named Fabric.api?

Python import error :No module named Fabric.api? Question: I am getting the following error: Traceback (most recent call last): File "drayd.py", line 2, in <module> from fabric.api import * **ImportError: No module named fabric.api** I am running my program using: python drayd.py These are my imports: import os,pprint from fabric.api import * import time import …

Total answers: 5

Create django super user in a docker container without inputting password

Create django super user in a docker container without inputting password Question: I am tring to createsuperuser in a django docker container with fabric. To create the super user in django, I need run this in a django interactive mode: ./manage.py createsuperuser And because I want to make it run in a fabric script, so …

Total answers: 12

Switching user in Fabric

Switching user in Fabric Question: I have a problem when using Fabric to mimic my SSH workflow to deploy my web application. Here’s my usual flow of commands when I SSH to a server: SSH using root user. ssh [email protected] Switch to web user: su – web Change directory: cd /srv/web/prod/abc_project Start virtualenv: workon abc_env …

Total answers: 3