GithubHelp home page GithubHelp logo

rhevm-qe-automation / python-rrmngmnt Goto Github PK

View Code? Open in Web Editor NEW

This project forked from machacekondra/python-rrmngmnt

1.0 1.0 33.0 267 KB

REmote REsources MaNaGeMeNT

License: GNU General Public License v2.0

Python 100.00%

python-rrmngmnt's People

Contributors

cynepco3hahue avatar ilpinto avatar leistnerova avatar lukas-bednar avatar lzitnits avatar machacekondra avatar mgold1234 avatar mkalfon avatar moshesheena avatar myakove avatar nellyc avatar obaireys avatar petr-balogh avatar polinaag avatar raztamir avatar roniezr avatar ronikish avatar santos1709 avatar sarahbx avatar slaykovsky avatar vkondula avatar vsibirsk avatar

Stargazers

 avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

python-rrmngmnt's Issues

Host.is_connective needs refactoring

is_connective - is not descriptive, it tests ssh connectivity, maybe I am interested in network connectivity in general (answer to ping) ...

I would like to see:

  1. network.py: is_connective function using ping command from local machine (client) to verify readability of machine
  2. ssh.py: is_connective function which tries to connect to machine via ssh.

in additional there could be function in network module is_port_open(port, proto='tcp'), but maybe later when it is needed.

Fix README.md

  • The requirements are not up to date
  • move Requirements below PM description
  • Move from md to rst, it is supported by pypi and github as well.

filesystem: implement mount / umount

there should be MountPoint class which holds all related parameters.
implements methods:

  • mount
  • umount
  • is_mounted

it can be used in storage.py for nfs service.

Update PlaybookRunner behaviour

SInce introduction of upload_playbook parameter to PlaybookRunner.run() method, we allow the users to upload the target playbook on their own to a remote resources. However, vars_files and vault_password_file parameters still require local paths and still upload local files to a remote host. We need to change PlaybookRunner.run() interface so that either

  • all provided paths are local and all the files get uploaded to a remote host automatically or
  • all provided paths are remote and it's up to the user to get those files to a remote resources

This should be driven by the value passed to upload_playbook parameter. For more context, see my conversation with Lukas here: https://github.com/rhevm-qe-automation/python-rrmngmnt/pull/129/files#r422892028

Support IPv6

there are several checks which validate host address whether it is ip4, so it is impossible to create Host with ip6 address

when using UserWithPKey function with private key that generated with Ed25519 algorithm it's fail

when using UserWithPKey function with private key that generated from 'ssh-keygen -t ed25519 -N ''
-f /<file_name>'. algorithm it doesn't work and failed on : Traceback (most recent call last):
File "/home/mgold/Downloads/pycharm-community-2020.1.2/plugins/python-ce/helpers/pydev/_pydevd_bundle/pydevd_exec2.py", line 3, in Exec
exec(exp, global_vars, local_vars)
File "", line 1, in
File "/home/mgold/rhevm-art/.art/lib/python3.6/site-packages/rrmngmnt/host.py", line 326, in service
service = self._create_service(name, timeout)
File "/home/mgold/rhevm-art/.art/lib/python3.6/site-packages/rrmngmnt/host.py", line 293, in _create_service
service = provider(self, name, timeout=timeout)
File "/home/mgold/rhevm-art/.art/lib/python3.6/site-packages/rrmngmnt/service.py", line 49, in init
self._can_handle()
File "/home/mgold/rhevm-art/.art/lib/python3.6/site-packages/rrmngmnt/service.py", line 173, in _can_handle
super(Systemd, self)._can_handle()
File "/home/mgold/rhevm-art/.art/lib/python3.6/site-packages/rrmngmnt/service.py", line 92, in _can_handle
io_timeout=self.timeout,
File "/home/mgold/rhevm-art/.art/lib/python3.6/site-packages/rrmngmnt/ssh.py", line 259, in run_cmd
with self.session(tcp_timeout) as session:
File "/home/mgold/rhevm-art/.art/lib/python3.6/site-packages/rrmngmnt/ssh.py", line 246, in session
return RemoteExecutor.Session(self, timeout)
File "/home/mgold/rhevm-art/.art/lib/python3.6/site-packages/rrmngmnt/ssh.py", line 66, in init
self._executor.user.private_key
File "/home/mgold/rhevm-art/.art/lib/python3.6/site-packages/paramiko/pkey.py", line 235, in from_private_key_file
key = cls(filename=filename, password=password)
File "/home/mgold/rhevm-art/.art/lib/python3.6/site-packages/paramiko/rsakey.py", line 55, in init
self._from_private_key_file(filename, password)
File "/home/mgold/rhevm-art/.art/lib/python3.6/site-packages/paramiko/rsakey.py", line 176, in _from_private_key_file
self._decode_key(data)
File "/home/mgold/rhevm-art/.art/lib/python3.6/site-packages/paramiko/rsakey.py", line 192, in _decode_key
n, e, d, iqmp, q, p = self._uint32_cstruct_unpack(data, "iiiiii")
File "/home/mgold/rhevm-art/.art/lib/python3.6/site-packages/paramiko/pkey.py", line 529, in _uint32_cstruct_unpack
raise SSHException(str(e))
paramiko.ssh_exception.SSHException: unpack requires a buffer of 4 bytes

need to initialize proper key class. there is class per each format in paramiko

Add option to remove packages which matches given pattern

Command which I am using looks like this:
remove_old_repo_cmd = [
'rpm', '-qa', ''(abc|drf)*'', '|', 'xargs', 'rpm',
'-e'
]

It would be great have this functionality in package_manager.
NOTE it should be encapsulated for all package managers which are covered by this module.

can't get release info with python3

Running my script with python3 fails. Python 2 is alright.

  return self.host.os.release_info
  File "/usr/local/lib/python3.6/site-packages/rrmngmnt/operatingsystem.py", line 82, in release_info
    self._release_info = self.get_release_info()
  File "/usr/local/lib/python3.6/site-packages/rrmngmnt/operatingsystem.py", line 73, in get_release_info
    values = line.split("=", 1)
TypeError: a bytes-like object is required, not 'str'
$ python3 --version
Python 3.6.4
$ pip3 list | grep rrmn
python-rrmngmnt (0.1.14)

storage: implement NFSService

today, there is NFSService class, providing mount/umount methods which seems to me be unrelated.
mount / umount is the responsibility of filesystem, and it is not related to nfs service.

I would expect methods like:

  • list_exports
  • add_export
  • remove_export
    ...

And add several lines to README

Host.copy_file move to filesystem module

move that method under filesystem module. and do some alignment.
it must be obvious whether I copy file:

  • from local host to remote
  • from remote host to local
  • from remote to remote

Make Host.add function thread safe

Now if I create two Host resources in different threads with the same IP I can fall in the situation:

  1. first thread check and see that the host exists under inventory
  2. second thread see that the host exists under inventory
  3. first thread run self.inventory.remove(host)
  4. second thread run self.inventory.remove(host)
  5. second thread fails with "list.remove(x): x not in list"

Add power management module

There should be way how to control power_management of Host.
At least for ssh, and ipmitool, and also add option to define own PM, for example for oVirt vms or something like that.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.