Skip to main content

Tool to manage remote systems and services

Project description

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.

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.

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.

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.

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

Network

It allows to manage network configuration.

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

# 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

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.

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

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

python setup.py devop

Test

tox

Project details


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.4.zip (58.0 kB view details)

Uploaded Source

python-rrmngmnt-0.1.4.tar.gz (42.0 kB view details)

Uploaded Source

Built Distributions

python_rrmngmnt-0.1.4-py2.7.egg (70.2 kB view details)

Uploaded Source

python-rrmngmnt-0.1.4-1.src.rpm (54.7 kB view details)

Uploaded Source

python-rrmngmnt-0.1.4-1.noarch.rpm (63.2 kB view details)

Uploaded Source

File details

Details for the file python-rrmngmnt-0.1.4.zip.

File metadata

File hashes

Hashes for python-rrmngmnt-0.1.4.zip
Algorithm Hash digest
SHA256 c79009160c847c3e3eef91aec3fa6c9159db48d1b83b36332080ff2ce2bf7103
MD5 f4788416b78f53f5ad99cfa0f30f5b3d
BLAKE2b-256 87e9f8a254e955c551bc73b6284c91526d6ca34fe4c83d1bc7963e69b408ebd5

See more details on using hashes here.

Provenance

File details

Details for the file python-rrmngmnt-0.1.4.tar.gz.

File metadata

File hashes

Hashes for python-rrmngmnt-0.1.4.tar.gz
Algorithm Hash digest
SHA256 09983a22cfcfb2b6c3b27395f43df11621ddec3908de14fec1879e4516c2dbee
MD5 f324e3fe4da57a0ad4947c8c5e74eb0f
BLAKE2b-256 7422fa360bd15cbf0df1ae3161915cd03b3404b7744717d62906c64f099dfc8c

See more details on using hashes here.

Provenance

File details

Details for the file python_rrmngmnt-0.1.4-py2.7.egg.

File metadata

File hashes

Hashes for python_rrmngmnt-0.1.4-py2.7.egg
Algorithm Hash digest
SHA256 1bf7985ad2dad955a626bb32cb1e8c9a6b8daecd477332224052cdc93bdfd4c8
MD5 6b75d22533ca2d5417871cc383900a35
BLAKE2b-256 c76714dae78542f85378c6f871d769b5ac30e02d101bfadaeec3084ac89c8aeb

See more details on using hashes here.

Provenance

File details

Details for the file python-rrmngmnt-0.1.4-1.src.rpm.

File metadata

File hashes

Hashes for python-rrmngmnt-0.1.4-1.src.rpm
Algorithm Hash digest
SHA256 85f941d4e544bd1280ad4bcd631eae0d33efc1cd4eb44463fa032493f21a12ca
MD5 ac14d117d08cb6e036313a212c026930
BLAKE2b-256 71db12a0e99a86e33c4f8121869526cc2d5b4163186618522c3fe68836cca3e1

See more details on using hashes here.

Provenance

File details

Details for the file python-rrmngmnt-0.1.4-1.noarch.rpm.

File metadata

File hashes

Hashes for python-rrmngmnt-0.1.4-1.noarch.rpm
Algorithm Hash digest
SHA256 5eaeeeb57bb296d11af44b01565f6e2e6f900b124bd276e74a0f8737a53c4ffd
MD5 f804c00819580e55171d4702e7ca6668
BLAKE2b-256 fcb4105c757af82542e6b07662d13ec57da62287488a143b72d8015d80aa3b13

See more details on using hashes here.

Provenance

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page