pyi2ncommon
2 years agoBump release, now version 1.6.6 v1.6.6
Christian Herdtweck [Fri, 10 Sep 2021 12:02:08 +0000]
Bump release, now version 1.6.6

2 years agoMerge branch 'arnied-wait-socket'
Christian Herdtweck [Fri, 10 Sep 2021 11:58:40 +0000]
Merge branch 'arnied-wait-socket'

2 years agoUse the already defined function to wait for generate
Samir Aguiar [Thu, 12 Aug 2021 21:26:25 +0000]
Use the already defined function to wait for generate

2 years agoImprove documentation of arnied wrapper and tests
Samir Aguiar [Tue, 31 Aug 2021 22:39:04 +0000]
Improve documentation of arnied wrapper and tests

2 years agoAdd a new function to wait for arnied to be ready
Samir Aguiar [Thu, 12 Aug 2021 12:54:14 +0000]
Add a new function to wait for arnied to be ready

Usually code depending on arnied checks whether its process is running
before proceeding, which can lead to a race condition when it is not
yet fully started. The new function makes use of a novel CLI option
in the arnied helper that blocks execution until arnied is indeed
ready to be used.

2 years agoFix unit tests
Samir Aguiar [Wed, 1 Sep 2021 01:23:04 +0000]
Fix unit tests

The dummy provider CNF variable was not in the correct form.

Also drop the TODO regarding raising an error when failing to go
online. The `run_cmd` function, which is mocked in the unit tests,
does check for the exit code of commands before returning.

2 years agoAdd license and doc to rpm package
Christian Herdtweck [Wed, 8 Apr 2020 15:54:51 +0000]
Add license and doc to rpm package

Failed to do this using setup.py and hacks in make_dist.py,
at least when doc and license files should not end up in
site-packages with the source code. Therefore change (and
simplify) the whole build process by re-creating
make_dist.py to just create a tarball that is compatible
with standard python spec files (like that of our QA) and
provide such a simple spec file to be used with rpmbuild.

2 years agoRemove superfluous doc/README
Christian Herdtweck [Thu, 2 Sep 2021 08:03:07 +0000]
Remove superfluous doc/README

3 years agoIncrease version to 1.6.5 v1.6.5
Christian Herdtweck [Thu, 25 Mar 2021 09:55:35 +0000]
Increase version to 1.6.5

3 years agoFix decoding on "get_cnf --json"
Juliana Rodrigueiro [Thu, 11 Mar 2021 13:37:51 +0000]
Fix decoding on "get_cnf --json"

The get_cnf command returns its output already in utf-8 when the
json switch is enabled. However the module cnfvar assumes that
raw data is always latin1, which is the case most of the time
when using arnied commands. This patch decodes the data, as we
know it is utf-8, before calling read_cnf_json.

Another caveat however, when the language locale is set to "C"
(which is currently the standard for avocado) before vm sessions
are started, every output (latin1 or utf-8) containing non ascii
characters will have those characters omitted (not garbled,
simply missing).

4 years agoIncrease version to 1.6.4 v1.6.4
Thomas Jarosch [Thu, 13 Feb 2020 15:30:10 +0000]
Increase version to 1.6.4

4 years agoSmall fix and comment for imap mailbox
Christian Herdtweck [Mon, 2 Dec 2019 12:11:08 +0000]
Small fix and comment for imap mailbox

4 years agoMinor fix: else --> elif
Christian Herdtweck [Thu, 5 Dec 2019 16:13:56 +0000]
Minor fix: else --> elif

Running both cases was impossible, anyway.

4 years agoFix typo in Group CnfVar builder
Christian Herdtweck [Thu, 5 Dec 2019 14:57:05 +0000]
Fix typo in Group CnfVar builder

4 years agoMinor improvement of comments for SimpleCnf
Christian Herdtweck [Mon, 2 Dec 2019 12:12:34 +0000]
Minor improvement of comments for SimpleCnf

4 years agoReplace all mentions of autotest with pyi2n-generic alternatives
Plamen Dimitrov [Wed, 5 Feb 2020 00:17:11 +0000]
Replace all mentions of autotest with pyi2n-generic alternatives

The only part we keep is using the Autotest email ID used from
a custom tool 'test_data_sync' which should be updated on one
separate batch.

4 years agoAdd support for new NIC_COMMENT field
Thomas Jarosch [Sat, 1 Feb 2020 18:26:30 +0000]
Add support for new NIC_COMMENT field

The comment field on NICs moves from the parent NIC
to a new NIC_COMMENT cnfvar.

4 years agoIncrease version to 1.6.3 v1.6.3
Christian Herdtweck [Thu, 14 Nov 2019 17:00:19 +0000]
Increase version to 1.6.3

4 years agoCreate ImapMailbox.fetch_{mail,message}
Christian Herdtweck [Thu, 14 Nov 2019 15:24:41 +0000]
Create ImapMailbox.fetch_{mail,message}

4 years agoMerge branch 'mail-to-extern'
Christian Herdtweck [Thu, 14 Nov 2019 16:22:33 +0000]
Merge branch 'mail-to-extern'

4 years agoAdd unittest for prepare_recipients
Christian Herdtweck [Thu, 14 Nov 2019 11:04:30 +0000]
Add unittest for prepare_recipients

4 years agoUpdate comments in mail validator tests
Christian Herdtweck [Thu, 14 Nov 2019 10:49:39 +0000]
Update comments in mail validator tests

4 years agoAllow sending mail to external recipients.
Christian Herdtweck [Thu, 14 Nov 2019 10:44:44 +0000]
Allow sending mail to external recipients.

Email sending functions had always assumed they send to local recipients.
However, with a little modification functions can be used to send to
external recipients, too.

4 years agoAdd validation for running arnied process for the unset_cnf function
Plamen Dimitrov [Tue, 19 Nov 2019 08:58:24 +0000]
Add validation for running arnied process for the unset_cnf function

This is the least developed arnied cnfvar function mostly because
we rarely had to unset any pre-existing cnfvar. Independently of
use cases, this function is required to validate the arnied process
is running in a similar manner to the more developed get/set functions.

4 years agoRefactor the entire waiting for GENERATE to allow for more arguments
Plamen Dimitrov [Thu, 14 Nov 2019 11:09:47 +0000]
Refactor the entire waiting for GENERATE to allow for more arguments

This code is completely redundant and has a much better implementation
in the more general waiting for a running program method.

4 years agoIncrease the available arguments for all current mk_config methods
Plamen Dimitrov [Thu, 14 Nov 2019 11:11:31 +0000]
Increase the available arguments for all current mk_config methods

The mk_config is a statistical hub for the way we do API calls to
the fully dynamic set_cnf bindings so it seems like a good place
to start implementing a more graspable unified cnfvar approach.

4 years agoIncrease version to 1.6.2 v1.6.2
Christian Herdtweck [Tue, 5 Nov 2019 10:59:32 +0000]
Increase version to 1.6.2

4 years agoRemove ISDN dialin related cnfvars
Thomas Jarosch [Mon, 4 Nov 2019 16:05:03 +0000]
Remove ISDN dialin related cnfvars

It does not seem to be used in pyi2ncommon or intra2net-qa anyway.

4 years agoMerge branch 'drop-cnfvar-translation'
Christian Herdtweck [Wed, 16 Oct 2019 14:00:45 +0000]
Merge branch 'drop-cnfvar-translation'

4 years agoMerge branch 'mkconfig-generalizations'
Christian Herdtweck [Wed, 16 Oct 2019 14:00:20 +0000]
Merge branch 'mkconfig-generalizations'

4 years agoDrop legacy cnfvar-autotest parameter translation
Plamen Dimitrov [Wed, 16 Oct 2019 08:56:26 +0000]
Drop legacy cnfvar-autotest parameter translation

4 years agoExtend the port forwarding mk_config function to proper port selection
Plamen Dimitrov [Fri, 4 Oct 2019 14:59:21 +0000]
Extend the port forwarding mk_config function to proper port selection

4 years agoUse a better default value for the nic type of newly defined nics
Plamen Dimitrov [Fri, 4 Oct 2019 14:53:16 +0000]
Use a better default value for the nic type of newly defined nics

4 years agoIncrease version to 1.6 v1.6
Christian Herdtweck [Thu, 8 Aug 2019 09:58:11 +0000]
Increase version to 1.6

Also mention "python" in description.

4 years agoMerge branch 'mail-utils-improvement'
Christian Herdtweck [Thu, 8 Aug 2019 09:55:02 +0000]
Merge branch 'mail-utils-improvement'

4 years agoFix timezone in test for parse_mail_date
Christian Herdtweck [Mon, 15 Jul 2019 11:06:36 +0000]
Fix timezone in test for parse_mail_date

4 years agoAdd option to parse newer EmailMessage type from mails
Christian Herdtweck [Mon, 15 Jul 2019 11:06:08 +0000]
Add option to parse newer EmailMessage type from mails

Sofar, parser policy was not specified, so "compat32" was used for compatibility
with python 3.2. Changing to the more modern "default" policy returns a different
type of message (EmailMessage instead of Message) that has quite some differences.
For example, EmailMessage.get(header_name) returns no longer str but a Header object.
This would break lots of code so use the old compat32 as default still.

4 years agoParse email from bytes instead of text
Christian Herdtweck [Mon, 15 Jul 2019 11:04:03 +0000]
Parse email from bytes instead of text

This allows usage of other encodings than the system encoding (e.g. latin1)

4 years agoCreate mail_utils test with latin1 encoded mail
Christian Herdtweck [Mon, 15 Jul 2019 11:02:19 +0000]
Create mail_utils test with latin1 encoded mail

4 years agoMove mail_validator tests into own test file
Christian Herdtweck [Mon, 15 Jul 2019 11:00:53 +0000]
Move mail_validator tests into own test file

4 years agoMinor fixes for mail_utils
Christian Herdtweck [Tue, 25 Jun 2019 11:34:32 +0000]
Minor fixes for mail_utils

- update module description
- add missing docu
- add link to MailValidator and ImapMailbox docu
- correct comment
- fix wrapping of 3 lines
- remove one useless else

4 years agoMove MailValidator into own module
Christian Herdtweck [Tue, 25 Jun 2019 11:05:12 +0000]
Move MailValidator into own module

mail_utils is getting overcrowded and MailValidator is about half of it
and rather independent of the rest.

4 years agoCreate ImapMailbox, a wrapper around python's IMAP4
Christian Herdtweck [Fri, 7 Jun 2019 07:21:15 +0000]
Create ImapMailbox, a wrapper around python's IMAP4

Python's built-in imap class offers little convenience. Add some
of our own with this class.

4 years agoCreate unittest for parse_mail_date
Christian Herdtweck [Tue, 4 Jun 2019 07:58:41 +0000]
Create unittest for parse_mail_date

4 years agoCreate mail_util parse_mail_date
Christian Herdtweck [Tue, 4 Jun 2019 07:56:14 +0000]
Create mail_util parse_mail_date

This is only a 2-liner now but started off as a more involved function
which was cut down when I realized: it is already implemented in python.

Leave this here, still, so I do not make that mistake again (and for the
small extra convenience).

4 years agoCreate function get_user_mail_files
Christian Herdtweck [Tue, 4 Jun 2019 07:52:54 +0000]
Create function get_user_mail_files

Sometimes do not need to parse the mail, just need to know how many/which
files there are.

4 years agoReturn after giving help in make_dist.py
Christian Herdtweck [Tue, 23 Jul 2019 09:40:37 +0000]
Return after giving help in make_dist.py

4 years agoBring back source check script
Christian Herdtweck [Thu, 8 Aug 2019 09:53:48 +0000]
Bring back source check script

Old script was deleted a few commits ago for version 1.5
(commit 81f7f6c7a16bc5e63228996cedf8ac83f45f3717).
This is a modified version from i2n avocado source.

5 years agoFix a bug in mail_utils.send_email_with_files
Christian Herdtweck [Tue, 16 Apr 2019 09:03:54 +0000]
Fix a bug in mail_utils.send_email_with_files

Implementation had assumed that isinstance(bool, int) is False. But bool
is a subclass of int, therefore logic did not work

5 years agoChange version to 1.5 v1.5
Christian Herdtweck [Mon, 15 Apr 2019 08:09:20 +0000]
Change version to 1.5

5 years agoRemove outdated check script. Will bring back as adapted copy from QA code
Christian Herdtweck [Mon, 15 Apr 2019 08:09:51 +0000]
Remove outdated check script. Will bring back as adapted copy from QA code

5 years agoIncrease version to 1.5 (alpha)
Christian Herdtweck [Tue, 9 Apr 2019 12:20:59 +0000]
Increase version to 1.5 (alpha)

5 years agoMerge branch 'py3.7-ssl-certs'
Christian Herdtweck [Tue, 9 Apr 2019 09:53:34 +0000]
Merge branch 'py3.7-ssl-certs'

5 years agoTake into account that certs are not issued to "localhost"
Christian Herdtweck [Tue, 9 Apr 2019 08:33:23 +0000]
Take into account that certs are not issued to "localhost"

Use FQDN instead

5 years agoMake certificate checks optional, enable per default
Christian Herdtweck [Tue, 9 Apr 2019 08:20:55 +0000]
Make certificate checks optional, enable per default

Also give an option to give an extra certificate to accept as .pem

5 years agoFix error type returned from failed POST
Christian Herdtweck [Tue, 9 Apr 2019 08:19:16 +0000]
Fix error type returned from failed POST

5 years agoAllow HTTPS connections with self-signed certificates
Plamen Dimitrov [Tue, 26 Mar 2019 03:53:52 +0000]
Allow HTTPS connections with self-signed certificates

We use such certificates on the web surface of the Intra2net system.

5 years agoImprove output of unittest
Christian Herdtweck [Tue, 9 Apr 2019 09:52:43 +0000]
Improve output of unittest

5 years agoCreate dist for python3.7 per default (and add help)
Christian Herdtweck [Tue, 9 Apr 2019 09:50:53 +0000]
Create dist for python3.7 per default (and add help)

Both Intra2net systems and avocado are now running on python3.7

5 years agoFix bad end of iterator and unused variable
Christian Herdtweck [Tue, 9 Apr 2019 09:50:11 +0000]
Fix bad end of iterator and unused variable

The StopIteration is a real error in python 3.7

5 years agoMerge branch 'py3.7-subprocess'
Christian Herdtweck [Tue, 9 Apr 2019 09:46:04 +0000]
Merge branch 'py3.7-subprocess'

5 years agoRemove unittests for removed function
Christian Herdtweck [Tue, 9 Apr 2019 09:43:24 +0000]
Remove unittests for removed function

5 years agoRemove obsoleted comment in the arnied wrapper docstring
Plamen Dimitrov [Tue, 26 Mar 2019 07:40:07 +0000]
Remove obsoleted comment in the arnied wrapper docstring

5 years agoDrop emulation of py3.5+ subprocess module for python 3.3
Plamen Dimitrov [Tue, 26 Mar 2019 07:36:13 +0000]
Drop emulation of py3.5+ subprocess module for python 3.3

The Intra2net system now relies on python 3.7 ridding us of all
this extra complexity.

5 years agoDefine new capture output flag for python 3.7 which is false by default
Plamen Dimitrov [Tue, 26 Mar 2019 07:30:50 +0000]
Define new capture output flag for python 3.7 which is false by default

This is a bad indicator of the backwards compatibility of minor versions
since adding the flag with a default like this would probably break a
lot of code down there. Sometimes it seems that python developers are
not really concerned with how many things they break in their minors.

5 years agoRemove the global TODO with outdated information
Plamen Dimitrov [Mon, 18 Feb 2019 12:28:56 +0000]
Remove the global TODO with outdated information

We can use Mantis BT, Trello, or other system for better
tracking of tasks.

5 years agoMake unittest output less distracting
Christian Herdtweck [Tue, 12 Feb 2019 10:30:37 +0000]
Make unittest output less distracting

That blinking really catches my eye every time, quite distracting.
Also limit output to a single line.

5 years agoImprove output of wait_for_email_transfer
Christian Herdtweck [Tue, 12 Feb 2019 10:21:46 +0000]
Improve output of wait_for_email_transfer

Most of all, warn if timeout was reached without finishing email transfer

5 years agoRun unittests in make_dist.py; update doc v1.4
Christian Herdtweck [Tue, 12 Feb 2019 09:20:54 +0000]
Run unittests in make_dist.py; update doc

5 years agoAdd release argument to make_dist.py
Christian Herdtweck [Tue, 12 Feb 2019 08:54:57 +0000]
Add release argument to make_dist.py

This should simplify introducing a proper labeling of development versions
of pyi2ncommon (the -avocado-test-X naming scheme did not prove successful)

5 years agoRe-run with LANG=C in unittest runner
Christian Herdtweck [Mon, 11 Feb 2019 09:27:58 +0000]
Re-run with LANG=C in unittest runner

5 years agoMerge branch 'cnfvar-autodetect-bytes'
Christian Herdtweck [Mon, 11 Feb 2019 12:20:04 +0000]
Merge branch 'cnfvar-autodetect-bytes'

5 years agoCreate unittest for read_cnf_json(non-ascii-str)
Christian Herdtweck [Mon, 11 Feb 2019 10:55:27 +0000]
Create unittest for read_cnf_json(non-ascii-str)

5 years agoFix unittest if run from non-unicode shell
Christian Herdtweck [Mon, 11 Feb 2019 10:54:50 +0000]
Fix unittest if run from non-unicode shell

When opening files (like os.devnull) in text mode, python uses the shell's
default encoding. In case LANG=C or when redirecting (for example), that
is just 'ascii', so writing non-ascii strings to /dev/null fails with
UnicodeError

5 years agoAdd and fix and few CNF_VAR-related doc strings
Christian Herdtweck [Mon, 11 Feb 2019 10:51:54 +0000]
Add and fix and few CNF_VAR-related doc strings

5 years agoAuto-detect str/bytes when dumping cnf vars
Christian Herdtweck [Mon, 11 Feb 2019 09:50:13 +0000]
Auto-detect str/bytes when dumping cnf vars

This is the second attempt to solve the problem when to "print" byte strings
and when to use regular unicode strings.

One problem is that sys.stdout can be a text stream or a byte stream
depending on shell environment.

5 years agoMerge branch 'make-dist-improvements'
Christian Herdtweck [Thu, 7 Feb 2019 15:45:54 +0000]
Merge branch 'make-dist-improvements'

5 years agoAvoid modifying wrong rpm from make_dist
Christian Herdtweck [Mon, 28 Jan 2019 10:26:18 +0000]
Avoid modifying wrong rpm from make_dist

Bughunting before was complicated by usage of wrong rpm files. Make tests
more strict to avoid finding wrong rpm

5 years agoRequire zipfile35 only for rpms for py<3.5
Christian Herdtweck [Mon, 28 Jan 2019 09:56:55 +0000]
Require zipfile35 only for rpms for py<3.5

5 years agoDocument build machine requirement in README
Christian Herdtweck [Mon, 28 Jan 2019 08:45:49 +0000]
Document build machine requirement in README

5 years agoAllow specify py version for make_dist
Christian Herdtweck [Mon, 28 Jan 2019 08:26:13 +0000]
Allow specify py version for make_dist

make_dist.py had assumed that py3.3 and py3.6 are installed on local machine.
Document that assumption and allow to deviate from it

5 years agoadd a minimal setup guide in order to build the RPMs
Plamen Dimitrov [Fri, 25 Jan 2019 11:37:49 +0000]
add a minimal setup guide in order to build the RPMs

5 years agoMerge branch 'cnfvar-byte-fixes'
Christian Herdtweck [Thu, 7 Feb 2019 15:43:19 +0000]
Merge branch 'cnfvar-byte-fixes'

5 years agoBe more precise about the binary in sysmisc cheat reboot docstring
Plamen Dimitrov [Mon, 21 Jan 2019 12:34:43 +0000]
Be more precise about the binary in sysmisc cheat reboot docstring

5 years agoPass byte stream to the cnfvar from the dynamic cnf setting
Plamen Dimitrov [Fri, 25 Jan 2019 17:32:03 +0000]
Pass byte stream to the cnfvar from the dynamic cnf setting

5 years agoIgnore some PyDev configuration in the git tree
Plamen Dimitrov [Fri, 25 Jan 2019 11:18:33 +0000]
Ignore some PyDev configuration in the git tree

5 years agoDeprecate irrelevant autotest comments in the cnfvar
Plamen Dimitrov [Fri, 25 Jan 2019 17:33:15 +0000]
Deprecate irrelevant autotest comments in the cnfvar

5 years agoMerge branch 'mail_utils-for-avocado-emailfilter'
Christian Herdtweck [Thu, 7 Feb 2019 15:35:33 +0000]
Merge branch 'mail_utils-for-avocado-emailfilter'

5 years agoFix cnfvar case of writing bytes from the io module
Plamen Dimitrov [Fri, 25 Jan 2019 17:31:40 +0000]
Fix cnfvar case of writing bytes from the io module

5 years agoUse a more robust condition in wait_for_email_transfer
Juliana Rodrigueiro [Wed, 6 Feb 2019 10:57:52 +0000]
Use a more robust condition in wait_for_email_transfer

This solution uses 'postqueue -j' command, which will produce an
empty list for stdout only when there are no more emails in the
queue. We become independent of the format of the output (byte,
string, specific characters, etc)

5 years agoCreate unittest for new mail_utils feature
Christian Herdtweck [Thu, 24 Jan 2019 15:50:39 +0000]
Create unittest for new mail_utils feature

5 years agoMerge branch 'arnied-fix-remote-scheduling'
Christian Herdtweck [Thu, 7 Feb 2019 15:22:26 +0000]
Merge branch 'arnied-fix-remote-scheduling'

5 years agoCreate new mail_utils option: get headers+attachments
Christian Herdtweck [Thu, 24 Jan 2019 15:43:08 +0000]
Create new mail_utils option: get headers+attachments

Often I parse and transfer big email message when actually
I only want the headers plus the attachment file names.

Create an option for this in mail_utils.parse_mail_file

5 years agoMerge branch 'call-helper-no-default-split'
Christian Herdtweck [Thu, 7 Feb 2019 15:20:36 +0000]
Merge branch 'call-helper-no-default-split'

5 years agoFix remote scheduling of programs
Samir Aguiar [Fri, 14 Dec 2018 18:28:00 +0000]
Fix remote scheduling of programs

When scheduling a program on a remote VM, the schedule file was
not being sent to the VM. Also, when removing previously schedule
files rm was waiting for confirmation since we didn't pass it
the `-f` option.

5 years agopylint/pydocstyle compliance for mail_utils
Christian Herdtweck [Tue, 4 Dec 2018 12:36:44 +0000]
pylint/pydocstyle compliance for mail_utils

- Wrapped long lines
- Added/Modified doc strings
- Replace single-letter variable names

5 years agoMerge branch 'cnfvar-fixes'
Christian Herdtweck [Thu, 7 Feb 2019 15:15:45 +0000]
Merge branch 'cnfvar-fixes'

5 years agotest_call_helpers: create unittests for subprocess_run
Christian Herdtweck [Fri, 21 Dec 2018 15:25:17 +0000]
test_call_helpers: create unittests for subprocess_run

Check that subprocess_run is compatible with python3.5 subprocess.run

5 years agoOverwrite run_cmd timeout in wait_for_run
Samir Aguiar [Fri, 14 Dec 2018 18:27:06 +0000]
Overwrite run_cmd timeout in wait_for_run

The default timeout of 60 seconds might not be enough

5 years agoCreate new mail util function to get body text(s)
Christian Herdtweck [Tue, 2 Oct 2018 11:02:07 +0000]
Create new mail util function to get body text(s)