Tool to manage remote systems and services
Project description
# python-rrmngmnt
Remote Resources MaNaGeMeNT
[![Build Status](https://travis-ci.org/rhevm-qe-automation/python-rrmngmnt.svg?branch=master)](https://travis-ci.org/rhevm-qe-automation/python-rrmngmnt)
## 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.
```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.
```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")
```
### Network
It allows to manage network configuration.
```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
```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
```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.
```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.
## Requires
* paramiko
* netaddr
### 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
```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()
```
## Install
```python
python setup.py devop
```
Remote Resources MaNaGeMeNT
[![Build Status](https://travis-ci.org/rhevm-qe-automation/python-rrmngmnt.svg?branch=master)](https://travis-ci.org/rhevm-qe-automation/python-rrmngmnt)
## 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.
```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.
```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")
```
### Network
It allows to manage network configuration.
```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
```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
```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.
```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.
## Requires
* paramiko
* netaddr
### 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
```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()
```
## Install
```python
python setup.py devop
```
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
python-rrmngmnt-0.1.2.zip
(54.4 kB
view details)
python-rrmngmnt-0.1.2.tar.gz
(38.8 kB
view details)
Built Distributions
python_rrmngmnt-0.1.2-py2.7.egg
(66.7 kB
view details)
python-rrmngmnt-0.1.2-1.src.rpm
(49.6 kB
view details)
File details
Details for the file python-rrmngmnt-0.1.2.zip
.
File metadata
- Download URL: python-rrmngmnt-0.1.2.zip
- Upload date:
- Size: 54.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 20686a4e0698ff8d5e79e014f813034f43aff91fa87676a6a98b778352510417 |
|
MD5 | d4dfc0621d1d39d5f05b0ad36ffd73be |
|
BLAKE2b-256 | ad019d9da49d8c8991cb8f610be98f6f4ffbd50612409d7cb4f0bb4a8f9a96d8 |
File details
Details for the file python-rrmngmnt-0.1.2.tar.gz
.
File metadata
- Download URL: python-rrmngmnt-0.1.2.tar.gz
- Upload date:
- Size: 38.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | e7f2bc1726227bb47f80b1123e1ad17700e5acadb69fc4037f9e112dcc9c2c1a |
|
MD5 | 581578a92c0335eb3907df21edf0c4c9 |
|
BLAKE2b-256 | b0554ef00aaaf73ec932c0833c7534987ccfc5f97be1d858a84d8b6525abb626 |
File details
Details for the file python_rrmngmnt-0.1.2-py2.7.egg
.
File metadata
- Download URL: python_rrmngmnt-0.1.2-py2.7.egg
- Upload date:
- Size: 66.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 87424c7ba13dc41aa61ff6ae68169f5dff0063ba49164c1786a54453444fd391 |
|
MD5 | 28408a1d1dffccf6bfb24728d6975112 |
|
BLAKE2b-256 | ed2cc0c00b9ae5b15e53c556cc1937afdfbcc4e453c456670b3c52c88be9e267 |
File details
Details for the file python-rrmngmnt-0.1.2-1.src.rpm
.
File metadata
- Download URL: python-rrmngmnt-0.1.2-1.src.rpm
- Upload date:
- Size: 49.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9ad5b51013c38431383835dcb91800237e1834e806bd017a0c77e789e7727943 |
|
MD5 | 7c492f86b8341436b89cdc683e2be50e |
|
BLAKE2b-256 | d9331428679e5defbe3d127a6c6b7abaef03e9d2990f51308e0d94318ca536c4 |
File details
Details for the file python-rrmngmnt-0.1.2-1.noarch.rpm
.
File metadata
- Download URL: python-rrmngmnt-0.1.2-1.noarch.rpm
- Upload date:
- Size: 59.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | b0cbaa6d38583a8c5b8de133883bde01710a87f6120574d879fe0c3a604256e8 |
|
MD5 | 46788e435e793847b2edeb1b2073f961 |
|
BLAKE2b-256 | 8ebecc36c01bf5027b7d31bffb8ec4adfdeb5ebdc585e148abfc54532a4c7322 |