Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Set tcp connection timeout #5

Open
wants to merge 59 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
59 commits
Select commit Hold shift + click to select a range
4cfcf34
Fix names in __all__, and super call (#59)
lukas-bednar May 25, 2016
e6c70e6
Enable code coverage monitoring (#60)
lukas-bednar May 26, 2016
da13aac
Add code coverage and health badge to readme (#61)
lukas-bednar May 26, 2016
ede0c96
Fix when FQDN is not resolved by socket.getfqdn(ip) (#62)
myakove Jun 7, 2016
4326f0e
Copy file with correct permissions and owner (#58)
cynepco3hahue Jun 20, 2016
b6ea845
Fixes issue #52 (#63)
lukas-bednar Jun 22, 2016
493c16c
Fixes issue #54: add -f for hostname cmd (#64)
lukas-bednar Jun 22, 2016
0516e8f
Python 3.5 compliance (#66)
lukas-bednar Jun 22, 2016
e5132e7
py26: drop python 2.6 compatibility (#69)
lukas-bednar Aug 17, 2016
45f9da1
host: make add to inventory thread safe (#68)
cynepco3hahue Aug 17, 2016
0a9f96e
Fix issue #71 related to create_script method (#72)
lukas-bednar Aug 18, 2016
e8842bf
Move Host.copy_to to filesystem module (#70)
lukas-bednar Aug 22, 2016
bb546ea
Modify FileSystem.touch method (#73)
vkondula Oct 3, 2016
849feff
Add filesystem.MountPoint (#74)
vkondula Oct 10, 2016
a5b2751
Add host with ipv6 (#75)
vkondula Oct 21, 2016
dda1a5d
Added file flush method for filesystem. (#76)
slaykovsky Nov 24, 2016
04f76aa
Added move method to filesystem class. (#77)
slaykovsky Nov 25, 2016
250d3a0
setup.cfg: set default sdist format (#78)
lukas-bednar Dec 1, 2016
7526857
Service: Don't fail when service have @ in the name
myakove Jan 17, 2017
246e2e3
Merge pull request #79 from myakove/master
nellyc Jan 23, 2017
601c0cf
power_manager: add reasonable timeout for SSH actions (#80)
cynepco3hahue Feb 13, 2017
36b217e
Fix test (#83)
lukas-bednar Mar 31, 2017
43c0e9e
Automate process to publish new release (#84)
lukas-bednar Apr 27, 2017
63fe633
Convert docstrings to google style (#86)
myakove May 3, 2017
3311a27
Added py36 matrix and classifier (#87)
lukas-bednar May 3, 2017
afb95f9
[fs] Added create file and isexec methods (#88)
slaykovsky May 15, 2017
10ce16e
network: add tcp and IO timeout to if_down function (#89)
cynepco3hahue Jun 5, 2017
9c492e1
Fix formatting error in lvchange function (#91)
lzitnits Jul 17, 2017
c470943
Add firewall module (#85)
lzitnits Aug 21, 2017
9d557c7
Network: Add netmask to network.get_info (#93)
myakove Nov 23, 2017
397793f
pypi deployment: update secure token
lukas-bednar Nov 27, 2017
af1074a
network.py module: add get interface speed function (#96)
mkalfon Jan 15, 2018
32f356a
network module raises Exception on command failure issue 51 (#97)
myakove Jan 16, 2018
75b37da
Add possibility to insert iptables rule (#98)
polinaag Jan 16, 2018
3fad2c4
travis-deploy: updated password for pip
lukas-bednar Jan 16, 2018
57a1315
network: pass appropriate arguments to CommandExecutionFailure except…
lukas-bednar Apr 16, 2018
45dabc0
tests: add docker runtime to run tests against to real system (#101)
lukas-bednar Apr 20, 2018
6baa740
ssh: translate bytes to string (#102)
lukas-bednar Apr 20, 2018
97dc5ee
Add logger info with journalctl output when systemd service action fails
May 15, 2018
c6bd126
Fix systemd services test for journalctl addition
May 15, 2018
302e398
Merge pull request #104 from KwisatzHaderach/systemd_service
petr-balogh May 16, 2018
dd95420
Network: Add get_interface_status function
myakove Jun 18, 2018
5cc53dc
Merge pull request #105 from myakove/network-get_interface_status
petr-balogh Jun 19, 2018
56d9481
unicode fix for ssh (#106)
leistnerova Aug 22, 2018
74032b6
Fix some PEP comments that travis found (#109)
MosheSheena Oct 30, 2018
f577d01
Change send_icmp to use OS default ping size (#110)
MosheSheena Oct 31, 2018
8ff1a19
Add -p, -m to fs.mkdir (#111)
leistnerova Dec 10, 2018
518c3c4
Add Database.psql_cmd to run special psql commands like \dt, \dv
Feb 8, 2019
5cd29dd
Fixed test for psql_cmd
Feb 8, 2019
a632e81
Fixed test for psql_cmd II.
Feb 8, 2019
614fe73
Fixed test for psql_cmd III.
Feb 8, 2019
bdebedc
Fixed commands for tests
Feb 11, 2019
66d87eb
Added negative test for psql_cmd
Feb 11, 2019
ded9491
Merge pull request #113 from leistnerova/master
petr-balogh Feb 13, 2019
db429e7
Add new function add_ip() (#114)
roniezr Mar 13, 2019
4b4d950
tests: pin to attrs-19.1.0 to enable tests execution (#116)
lukas-bednar Oct 30, 2019
910dc86
Add PlaybookRunner service (#117)
Nov 21, 2019
e12c8b0
Support Python3 (#118)
roniezr Jan 10, 2020
d9114fc
Set TCP connection timeout
ILpinto Jan 15, 2020
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 20 additions & 5 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,24 @@
language: python
sudo: required
services:
- docker
python:
- "2.6"
- "2.7"
- "3.4"
- '2.7'
- '3.4'
- '3.5'
- '3.6'
install:
- pip install tox
- pip install tox tox-travis codecov
script:
- tox
- tox
after_success:
- codecov
deploy:
provider: pypi
user: lukas-bednar
password:
secure: AlKh1Zv2+PjPa5W2RhHT0OtECmmNzDpSr+sWCDBFUnuZFiCLqXiD+aMxLCIbq0cndODhOd3MMXu3lKxNtmO5/7zUrSkHG0VRsqBj7yNabzJgp+rLX1FmKaw/20IuiNVhV31uh3MU1sHPBDNoU9S67SCiKk/L/k6t2wFTbac6gyiJ5D8HD4bukyhbGRf4GIFlibHLCq6GvSTCqEdSSnCVF/jSai4r5C7MicDpc3Osxud2EohnbcRT9aujKPxYzoTmworF2ZgIZqOUHoBo2oC8GdJlNOYdx/pBFYipMFxuWAHwZGiywxnob0ORgd54UxvTcvbXCIBPv4fjgrJRsJzoB2bH6QtG48RyCQIFrNOSDr/bPNP3XnvzG3yeAZ/Mxy50i9O4YhqgYum/VUBzvdU6SqFaDc/3FXt8dCz9AlPW1f2NMaElHREUJCXH17BjP1ziccUse7AhunHqMMLtIbuLAT8vZe0tJIAwgB/MSn9fFm4ME2oEeVRW4s8LVDIgc2LLKJ4AxwaZXfL6G8BgRV26EHgbPLwDMKDDKtaUL8KcY6TtTUx3pwDFrL+hOkhfE0Q302t6GI0UqG1t0pRweVfgpDHni4ReaHjDNXQqhKmMwrTRIQMVXPKoD3oHZMAyRtJW85e55aKVIO7iEEvhJCstU7tVmkCsJZcfFU//H+i9mVQ=
on:
branch: master
tags: true
skip_upload_docs: true
133 changes: 0 additions & 133 deletions README.md

This file was deleted.

225 changes: 225 additions & 0 deletions README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,225 @@
|Build Status|
|Code Coverage|
|Code Health|

python-rrmngmnt
===============

Remote Resources MaNaGeMeNT

Intro
-----

This tool helps you manage remote machines and services running on that.
It is targeted to Linux based machines. All is done via SSH connection,
that means SSH server must be running there already.

.. code:: python

from rrmngmnt import Host, RootUser

h = Host("10.11.12.13")
h.users.append(RootUser('123456'))
exec = h.executor()
print exec.run_cmd(['echo', 'Hello World'])

Features
--------

List of provided interfaces to manage resources on machine, and
examples.

Filesystem
~~~~~~~~~~

Basic file operations, you can find there subset of python 'os' module
related to files.

.. code:: python

print h.fs.exists("/path/to/file")
h.fs.chown("/path/to/file", "root", "root")
h.fs.chmod("/path/to/file", "644")
h.fs.unlink("/path/to/file")

In additional there are methods to fetch / put file from / to remote system
to / from local system.

.. code:: python

h.fs.get("/path/to/remote/file", "/path/to/local/file/or/target/dir")
h.fs.put("/path/to/local/file", "/path/to/remote/file/or/target/dir")

There is one special method which allows transfer file between hosts.

.. code:: python

h1.fs.transfer(
"/path/to/file/on/h1",
h2, "/path/to/file/on/h2/or/target/dir",
)

You can also mount devices.

.. code:: python

with h.fs.mount_point(
'//example.com/share', opts='ro,guest',
fstype='cifs', target='/mnt/netdisk'
) as mp:
h.fs.listdir(mp.target) # list mounted directory
mp.remount('rw,sync,guest') # remount with different options
h.fs.touch('%s/new_file' % mp.target) # touch file

Firewall
~~~~~~~~

Allows to manage firewall configurarion. Check which firewall service is
running on host (firewalld/iptables) and make configure this service.

.. code:: python

h.firewall.is_active('iptables')
h.firewall.chain('OUTPUT').list_rules()
h.firewall.chain('OUTPUT').add_rule('1.1.1.1', 'DROP')


Network
~~~~~~~

It allows to manage network configuration.

.. code:: python

print h.network.hostname
h.network.hostname = "my.machine.org"
print h.network.all_interfaces()
print h.network.list_bridges()

Package Management
~~~~~~~~~~~~~~~~~~

It encapsulates various package managements. It is able to determine
which package management to use. You can still specify package management
explicitly.


Implemented managements:

- APT
- YUM
- DNF
- RPM

.. code:: python

# install htop package using implicit management
h.package_management.install('htop')
# remove htop package using rpm explicitly
h.package_management('rpm').remove('htop')

System Services
~~~~~~~~~~~~~~~

You can toggle system services, it encapsulates various service managements.
It is able to determine which service management to use in most cases.


Implemented managements:

- Systemd
- SysVinit
- InitCtl

.. code:: python

if h.service('httpd').status():
h.service('httpd').stop()
if h.service('httpd').is_enabled():
h.service('httpd').disable()

Operating System Info
~~~~~~~~~~~~~~~~~~~~~

Host provide ``os`` attribute which allows obtain basic operating
system info.
Note that ``os.release_info`` depends on systemd init system.

.. code:: python

print h.os.distribution
# Distribution(distname='Fedora', version='23', id='Twenty Three')

print h.os.release_info
# {'HOME_URL': 'https://fedoraproject.org/',
# 'ID': 'fedora',
# 'NAME': 'Fedora',
# 'PRETTY_NAME': 'Fedora 23 (Workstation Edition)',
# 'VARIANT': 'Workstation Edition',
# 'VARIANT_ID': 'workstation',
# 'VERSION': '23 (Workstation Edition)',
# 'VERSION_ID': '23',
# ...
# }

print h.os.release_str
# Fedora release 23 (Twenty Three)

Storage Management
~~~~~~~~~~~~~~~~~~

It is in PROGRESS state. Planed are NFS & LVM services.

Power Management
~~~~~~~~~~~~~~~~

Give you possibility to control host power state, you can restart,
poweron, poweroff host and get host power status.


Implemented managements:

- SSH
- IPMI

.. code:: python

ipmi_user = User(pm_user, pm_password)
ipmi_params = {
'pm_if_type': 'lan',
'pm_address': 'test-mgmt.testdomain',
'user': ipmi_user
}
h.add_power_manager(
power_manager.IPMI_TYPE, **ipmi_params
)
# restart host via ipmitool
h.power_manager.restart()

Requires
--------

- paramiko
- netaddr
- six

Install
-------

.. code:: sh

python setup.py devop

Test
----

.. code:: sh

tox

.. |Build Status| image:: https://travis-ci.org/rhevm-qe-automation/python-rrmngmnt.svg?branch=master
:target: https://travis-ci.org/rhevm-qe-automation/python-rrmngmnt
.. |Code Coverage| image:: https://codecov.io/gh/rhevm-qe-automation/python-rrmngmnt/branch/master/graph/badge.svg
:target: https://codecov.io/gh/rhevm-qe-automation/python-rrmngmnt
.. |Code Health| image:: https://landscape.io/github/rhevm-qe-automation/python-rrmngmnt/master/landscape.svg?style=flat
:target: https://landscape.io/github/rhevm-qe-automation/python-rrmngmnt/master
Loading