Page 1 of 2

Socket error #10061 Connection Refused.

Published: November 20, 2015 - 4:43 PM
by knpc
Hello,

I'm completely new to WAPT and when I try to create a custom installer, I get a socket error message. When I acknowledge the error, I get the following message:

Error loading the WAPT agent to the repository.

Thank you for your help.

Patrice

Re: Socket error #10061 Connection Refused.

Published: November 24, 2015 - 11:56 AM
by Floflobel
Hello,

could you please provide us with the configuration of your setup.py file located in C:\wapt? This will allow us to view your repository configuration from your WAPT server.

Re: Socket error #10061 Connection Refused.

Published: November 25, 2015 - 4:26 PM
by knpc
Good morning,

Thank you for your help. I can only find the setup.py file in the WAPT\WAPTUPGRADE folder.
I don't have any files with that name directly in the WAPT directory

I'm attaching an image of the py files located in my wapt folder
I'm including the contents of the setup.py file because I can't paste it as an attachment

Thank you for your help

Knpc
contents of the wapt folder
contents of the wapt folder
File extension py.JPG (43.89 KB) Viewed 9060 times
SETUP.PY FILE

# -*- coding: utf-8 -*-
import from setuphelpers *
import os
import _winreg
import tempfile
import shutil

# registry key(s) where WAPT will find how to remove the application(s)
uninstallkey = []

def update_sources():
files = [
'common.py',
'setuphelpers.py',
'wapt-get.exe',
'wapt-get.exe.manifest',
'wapt-get.py',
'waptdevutils.py',
'waptpackage.py',
'windnsquery.py',
'wapttray.exe',
'waptexit.exe',
'keyfinder.py',
'COPYING.txt',
'templates',
'waptconsole.exe',
'waptconsole.exe.manifest',
'waptservice',
'languages',


r'lib\site-packages\babel\__init__.py',
r'lib\site-packages\babel\_compat.py',
r'lib\site-packages\babel\core.py',
r'lib\site-packages\babel\global.dat',
r'lib\site-packages\babel\localtime',
r'lib\site-packages\babel\plural.py',
r'lib\site-packages\babel\localedata\en.dat',
r'lib\site-packages\babel\localedata\fr.dat',
r'lib\site-packages\babel\messages',
r'lib\site-packages\babel\support.py',
r'lib\site-packages\babel\compat.py',
r'lib\site-packages\babel\dates.py',
r'lib\site-packages\babel\localedata.py',
r'lib\site-packages\babel\numbers.py',
r'lib\site-packages\babel\util.py',

r'lib\site-packages\flask_babel',
r'lib\site-packages\pytz',
r'lib\site-packages\speaklater',
r'lib\site-packages\requests_kerberos_sspi',
r'lib\site-packages\lib\site-packages\flask_kerberos_sspi.py',
r'lib\site-packages\kerberos_sspi.py',
r'lib\site-packages\wapt.pth',
]

def ignore(src,names):
result = []
for name in names:
for pattern in ['*.pyc','*.exe']:
if glob.fnmatch.fnmatch(name,pattern):
result.append(name)
return result

checkout_dir = os.path.abspath(os.path.join(os.getcwd(),'..'))
# cleanup patches dir
if os.path.exists(os.path.join(checkout_dir,'waptupgrade','patches')):
shutil.rmtree(os.path.join(checkout_dir,'waptupgrade','patches'))

os.makedirs(os.path.join(checkout_dir,'waptupgrade','patches'))
for f in files:
fn = os.path.join(checkout_dir,f)
target_fn = os.path.join(checkout_dir,'waptupgrade','patches',f)
if os.path.isfile(fn):
if not os.path.exists(os.path.dirname(target_fn)):
os.makedirs(os.path.dirname(target_fn))
filecopyto(fn,target_fn)
elif os.path.isdir(fn):
copytree2(
src=fn,
dst=target_fn,
onreplace = default_overwrite,
ignore=ignore)
return True

def update_control(entry):
"""Update package control file before build-upload"""
if update_sources():
waptget = get_file_properties(r'patches\wapt-get.exe')
rev = open('../version').read().strip()
entry.package = '%s-waptupgrade' % WAPT.config.get('global','default_package_prefix')
entry.version = '%s-%s' % (waptget['FileVersion'],rev)
else:
print(u'Keeping current control data %s (%s)'%(control.package,control.version))

def update_registry_version(version):
# updatethe registry
with _winreg.CreateKeyEx(HKEY_LOCAL_MACHINE,r'SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\WAPT_is1',\
0, _winreg.KEY_READ| _winreg.KEY_WRITE ) as waptis:
reg_setvalue(waptis,"DisplayName","WAPT %s" % version)
reg_setvalue(waptis,"DisplayVersion","WAPT %s" % version)
reg_setvalue(waptis,"InstallDate",currentdate())



def copytree2(src, dst, ignore=None, onreplace=default_skip, oncopy=default_oncopy, enable_replace_at_reboot=True, onerror=None):
"""Copy src directory to dst directory. dst is created if it doesn't exist
src can be relative to installation temporary dir
oncopy is called for each file copy. if False is returned, copy is skipped
onreplace is called when a file will be overwritten.
"""
logger.debug('Copy tree from "%s" to "%s"' % (ensure_unicode(src),ensure_unicode(dst)))
# path relative to temp directory...
tempdir = os.getcwd()
if not os.path.isdir(src) and os.path.isdir(os.path.join(tempdir,src)):
src = os.path.join(tempdir,src)

names = os.listdir(src)
if callable(ignore) and ignore is not None:
ignored_names = ignore(src, names)
else:
ignored_names = set()

if not os.path.isdir(dst):
if oncopy('create directory',src,dst):
os.makedirs(dst)
errors = []
for name in names:
if name in ignored_names:
continues
srcname = os.path.join(src, name)
dstname = os.path.join(dst, name)
try:
if os.path.isdir(srcname):
if oncopy('directory',srcname,dstname):
copytree2(srcname, dstname, ignore = ignore, onreplace=onreplace, oncopy=oncopy)
else:
if os.path.isfile(dstname):
if onreplace(srcname,dstname) and oncopy('overwrites',srcname,dstname):
os.unlink(dstname)
shutil.copy2(srcname, dstname)
else:
if oncopy('copy',srcname,dstname):
shutil.copy2(srcname, dstname)

except (IOError, os.error) as why:
#print(u'IO Error copying from "%s" to "%s": %s' % (ensure_unicode(src),ensure_unicode(dst),ensure_unicode(why)))
if onerror is not None and callable(onerror):
try:
onerror(srcname,dstname,why)
except Exception as e:
errors.append((srcname,dstname,ensure_unicode(e)))
else:
errors.append((srcname,dstname,ensure_unicode(why)))

# catch the Error from the recursive copytree so that we can
# continue with other files
except shutil.Error as err:
logger.critical(u'shutil Error copying from "%s" to "%s": %s' % (ensure_unicode(srcname),ensure_unicode(dstname),ensure_unicode(err)))
errors.extend(err.args[0])
try:
shutil.copystat(src, dst)
Except for OSError, why?
if WindowsError is not None and isinstance(why, WindowsError):
# Copying file access times may fail on Windows
pass
else:
print(u'Error copying stats from "%s" to "%s": %s' % (ensure_unicode(src),ensure_unicode(dst),ensure_unicode(why)))
errors.append((src, dst, str(why)))
if errors:
raise shutil.Error, errors



def add_at_cmd(cmd,delay=1):
import datetime
at_time = (datetime.datetime.now() + datetime.timedelta(minutes=delay)).strftime('%H:%M:%S')
print(run('at %s "%s"'%(at_time,cmd)))


def install():
# if you want to modify the keys depending on environment (win32/win64... params..)
print(u'Partial upgrade of WAPT client')
killalltasks('wapttray.exe')
killalltasks('waptconsole.exe')

def onerror(srcname,dstname,e):
print u"Error %s %s %s" %(srcname,dstname,ensure_unicode(e))
if e[0] == 5: # locked
filecopyto(srcname,dstname+'.pending')
replace_at_next_reboot(None, dstname)
else:
raise e

def check_exe_version(src,dst):
if os.path.splitext(dst)[1] in ('.exe','.dll'):
try:
ov = get_file_properties(dst)['FileVersion']
nv = get_file_properties(src)['FileVersion']
return Version(ov)
except:
return True
else:
return True

copytree2('patches',WAPT.wapt_base_dir,
onreplace = check_exe_version,
onerror = onerror)

update_registry_version(control.version)

# restart of service cannot be done by service...
if service_installed('waptservice') and service_is_running('waptservice'):
import requests,json
try:
res = json.loads(requests.get('http://127.0.0.1:8088/waptservicerestart.json').text)
except:
tmp_bat = tempfile.NamedTemporaryFile(prefix='waptrestart',suffix='.cmd',mode='wt',delete=False)
tmp_bat.write('net stop waptservice\n')
tmp_bat.write('net start waptservice\n')
tmp_bat.write('del "%s"\n'%tmp_bat.name)
tmp_bat.close()
add_at_cmd(tmp_bat.name)
print(u'Upgrade done')

Re: Socket error #10061 Connection Refused.

Published: November 26, 2015 - 12:17 PM
by Floflobel
Hello,

I just found the file in question, which is "wapt-get.ini".
Could you post it here?

Thanks

Re: Socket error #10061 Connection Refused.

Published: November 26, 2015 - 2:49 PM
by knpc
Here it is :-)

: WAPT-GET.INI FILE:


[global]
waptupdate_task_period=120
use_hostpackages=1
repo_url=https://srvwapt.mont-tremblant.local/wapt
wapt_server=https://srvwapt.mont-tremblant.local
private_key=C:\private\monttremblant.pem
templates_repo_url=http://wapt.tranquil.it/wapt
default_sources_root=E:\wapt\WaptDev
default_package_prefix=mtt
loglevel=warning

[options]
server_uuid=f444b1ab-6e89-47f9-8d3a-8f8d3ffe1a49

- Just to clarify, I'm on an IIS server
- I get the same "connection refused" message when trying to connect to the console. Are the two related?

In this .ini file, I don't have a database entry. Is that normal?

Thank you.

Re: Socket error #10061 Connection Refused.

Published: November 30, 2015 - 1:09 PM
by Floflobel
You can ping: https://srvwapt.mont-tremblant.local/wapt
and see what the URL returns?

Re: Socket error #10061 Connection Refused.

Published: November 30, 2015 - 2:35 PM
by knpc
Hi,

I can ping srvwapt.mont-tremblant.local
but I can't ping https://srvwapt.mont-tremblant.local/wapt. I think that's normal.
The console I'm using is directly on the Wapt server.

Just FYI, it works with localhost:8088; I have access to the console.

Thanks.

Re: Socket error #10061 Connection Refused.

Published: Dec 7, 2015 - 3:53 PM
by knpc
Hi everyone,

I'm still having trouble solving my problem so I hope to get some help by bumping my post.

Thanks.

Re: Socket error #10061 Connection Refused.

Published: Dec 7, 2015 - 4:57 PM
by sfonteneau
Hello,

can you tell us more?

Is it a Windows server or a Linux server?

Are any services other than WAPT hosted on these servers?

Simon

Re: Socket error #10061 Connection Refused.

Published: Dec 7, 2015 - 10:07 PM
by knpc
With pleasure:

It's a 2008 server with only WSUS installed.
IIS was configured following the Wapt guide.

If you need any further information, just ask.

Thank you