[RESOLVED] Package error following WAPT 2.0 update

Questions about WAPT Packaging / Requests and help regarding Wapt packages.
Forum Rules
Community Forum Rules
* English support on www.reddit.com/r/wapt
* French community support is available on this forum
* Please prefix the topic title with [RESOLVED] if it is resolved.
* Please do not edit a topic that is tagged [RESOLVED]. Open a new topic referencing the old one.
* Specify the installed WAPT version, full version, and build number (2.2.1.11957 / 2.2.2.12337 / etc.) as well as the Enterprise/Discovery edition.
* Versions 1.8.2 and earlier are no longer supported. The only questions accepted regarding version 1.8.2 are related to upgrading to a supported version (2.1, 2.2, etc.).
* Specify the server OS (Linux/Windows) and version (Debian Buster/Bullseye - CentOS 7 - Windows Server 2012/2016/2019).
* Specify the OS of the administration/package creation machine and the machine with the problematic agent, if applicable (Windows 7/10/11/Debian 11/etc.).
* Avoid asking multiple questions when opening a topic, otherwise it may be ignored. If there are multiple topics, open separate topics, preferably one after the other and not all at the same time (i.e., do not spam the forum).
* Include code snippets, screenshots, and other images directly in the post. Links to Pastebin, Bitly, and other third-party sites will be systematically removed.
* As with any community forum, support is provided voluntarily by members. If you require commercial support, you can contact Tranquil IT's sales department at 02.40.97.57.55
Alann
Messages: 8
Registration: Nov 17, 2020 - 08:19

May 6, 2021 - 5:00 PM

Good morning,

I developed a package for post-installation configuration of Windows on my network, initially on WAPT 1.8.
The idea is to configure a newly installed workstation by finding its name from its IP address using a reverse DNS lookup.
For that, I use the dnspython module.

Since upgrading to WAPT 2.0, the installation returns an error: AttributeError: 'GenericRdata' object has no attribute 'target'

This error refers to a piece of code:

Code: Select all

def findmachinename(ip):
    pass
    no = dns.reversename.from_address(ip)
    answers = dns.resolver.query(no, 'PTR')
    for rdata in answers:
        nom = rdata
    nommachine = nom.target[0].decode("utf-8")
    return nommachine
The curious thing is that this code works perfectly when run locally on PyScripter, but it fails when deployed to workstations.

Any ideas?
User avatar
Gaetan
Messages: 169
Registration: August 8, 2019 - 10:16
Location: Toulouse

May 7, 2021 - 09:22

Hi Alann,
is the dnspython package imported at the beginning of your code?
If that doesn't work, perhaps try packaging it with the other package?
Alann
Messages: 8
Registration: Nov 17, 2020 - 08:19

May 7, 2021 - 09:26

At the beginning of the code I have a

Code: Select all

import dns.resolver
import dns.reversename
How do I package it with the package?
User avatar
Gaetan
Messages: 169
Registration: August 8, 2019 - 10:16
Location: Toulouse

May 7, 2021 - 10:42

Is it possible to get the error output directly?
Alann
Messages: 8
Registration: Nov 17, 2020 - 08:19

May 7, 2021 - 10:50

I restarted the installation on a freshly installed machine:

Code: Select all

Traceback (most recent call last):
  File "C:\Program Files (x86)\wapt\common.py", line 3841, in install_wapt
    setup = import_setup(setup_filename)
  File "C:\Program Files (x86)\wapt\waptutils.py", line 1498, in import_setup
    py_mod = imp.load_source(modulename, setupfilename)
  File "imp.py", line 171, in load_source
  File "<frozen importlib._bootstrap>", line 702, in _load
  File "<frozen importlib._bootstrap>", line 671, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 783, in exec_module
  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
  File "C:\windows\TEMP\wapt48wx8rls\setup.py", line 5, in <module>
ModuleNotFoundError: No module named 'dns'
ModuleNotFoundError: No module named 'dns'
Apparently, I need to integrate the dnspython module into the wapt package. I don't know how to do it...
User avatar
dcardon
WAPT Expert
Messages: 1932
Registration: June 18, 2014 - 09:58
Location: Saint Sébastien sur Loire
Contact :

May 7, 2021 - 3:37 PM

Hi Alann,
the dnspython library shouldn't be very large; it's best to include it in the package. You can download the zip file from https://pypi.org/project/dnspython/#files , then extract the "/dns" directory from it and place it in the root directory of your package next to setup.py.
Regards,
Denis
Denis Cardon - Tranquil IT
Share your experiences on WAPT! Send us your blog and article URLs in the "Your Opinion of the forum, and we'll feature them on the WAPT
Alann
Messages: 8
Registration: Nov 17, 2020 - 08:19

May 7, 2021 - 3:52 PM

Hello Denis, and thank you for your reply.

It works perfectly.

The solution was so simple...
Alann
Messages: 8
Registration: Nov 17, 2020 - 08:19

May 8, 2021 - 6:47 PM

If I had to nitpick, there would just be one point:

The audit on the machines gives the same error message, even though the installation is OK.

Code: Select all

Audit aborted due to exception: No module named 'dns'
User avatar
Gaetan
Messages: 169
Registration: August 8, 2019 - 10:16
Location: Toulouse

May 19, 2021 - 3:45 PM

Hello Alann,

is it possible to get the complete package code?
Alann
Messages: 8
Registration: Nov 17, 2020 - 08:19

May 20, 2021 - 09:24

Problem solved.

It was simply a matter of placing the "dns" folder from the PyDSN module in the package.

Remember to also create a copytree to add it to the clients' WAPT libraries; otherwise, package auditing will return an error.
Locked