SAB ignoreing host setting in conf [solved]

Get help with all aspects of SABnzbd
Forum rules
Help us help you:
  • Are you using the latest stable version of SABnzbd? Downloads page.
  • Tell us what system you run SABnzbd on.
  • Adhere to the forum rules.
  • Do you experience problems during downloading?
    Check your connection in Status and Interface settings window.
    Use Test Server in Config > Servers.
    We will probably ask you to do a test using only basic settings.
  • Do you experience problems during repair or unpacking?
    Enable +Debug logging in the Status and Interface settings window and share the relevant parts of the log here using [ code ] sections.
User avatar
sander
Release Testers
Release Testers
Posts: 9429
Joined: January 22nd, 2008, 2:22 pm

Re: SAB ignoreing host setting in conf

Post by sander »

Weird ... in sequential order (and with :: set in sabnzbd.ini):

Code: Select all

sander@R540:~/SABnzbd-0.7.2RC1$ python SABnzbd.py 
Into get_webhost ...
('cherryhost 1 is %s', None)
('cherryhost 2 is %s', None)
('cherryhost 3 is %s', '::')
('cherryhost 5 is %s', '::')
('cherryhost 666 is %s', '::')
2012-07-13 11:25:15,112::INFO::[SABnzbd:1292] --------------------------------
So: first None (as input), then ::? I don't understand.

This is the code in SABnzbd.py:

Code: Select all

#------------------------------------------------------------------------------
def get_webhost(cherryhost, cherryport, https_port):
    """ Determine the webhost address and port,
        return (host, port, browserhost)
    """

    print('Into get_webhost ...') 		# SJ

    print("cherryhost 1 is %s", cherryhost) 	# SJ

    if cherryhost == '0.0.0.0' and not ipv_localhost('4'):
        cherryhost = ''
    elif cherryhost == '::' and not ipv_localhost('6'):
        cherryhost = ''

    print("cherryhost 2 is %s", cherryhost) 	# SJ


    if cherryhost is None:
        cherryhost = sabnzbd.cfg.cherryhost()
    else:
        sabnzbd.cfg.cherryhost.set(cherryhost)

    print("cherryhost 3 is %s", cherryhost) 	# SJ
So in my config cherrypost gets filled from sabnzbd.cfg.cherryhost ?
User avatar
shypike
Administrator
Administrator
Posts: 19773
Joined: January 18th, 2008, 12:49 pm

Re: SAB ignoreing host setting in conf

Post by shypike »

Makes sense, doesn't it?
When you do not specify a hostname on the command line, it's read from the INI file.
None means that you didn't give a command line value.
User avatar
sander
Release Testers
Release Testers
Posts: 9429
Joined: January 22nd, 2008, 2:22 pm

Re: SAB ignoreing host setting in conf

Post by sander »

shypike wrote:Makes sense, doesn't it?
When you do not specify a hostname on the command line, it's read from the INI file.
None means that you didn't a command line value.
Ahhhhh! OK. Clear. Thanks.
User avatar
shypike
Administrator
Administrator
Posts: 19773
Joined: January 18th, 2008, 12:49 pm

Re: SAB ignoreing host setting in conf

Post by shypike »

I don't blame you for not following it easily.
I get a headache each time I have to do something in that code :(
whytewolf
Newbie
Newbie
Posts: 6
Joined: July 12th, 2012, 1:29 pm

Re: SAB ignoreing host setting in conf

Post by whytewolf »

Eureka!!!
once i saw this line i knew exactly what was wrong.

info = socket.getaddrinfo(socket.gethostname(), None)

since it was a private server. it's internal hostname for the entire system was set to a nonsensical word not the actual hostname. and since i was lazy that was not put into the host file. once i put both into the hosts file it works.

I'm not sure about this logic. just because hostname on a system isn't setup right doesn't mean that ip based configs should be ignored.
User avatar
sander
Release Testers
Release Testers
Posts: 9429
Joined: January 22nd, 2008, 2:22 pm

Re: SAB ignoreing host setting in conf

Post by sander »

@shypike:

I think it would useful if sabnzbd would log strange things it discovers in get_webhost(). That way it would be easier to analyze and solve problems. See the last post of whytewolf.
User avatar
shypike
Administrator
Administrator
Posts: 19773
Joined: January 18th, 2008, 12:49 pm

Re: SAB ignoreing host setting in conf [solved]

Post by shypike »

Hmmm, you're right about the logging, only logging isn't active.
I'll see what I can do.

What I find hard to understand the cavalier approach that Linux distros
have towards setting up a proper node name.
"uname -n" should give a name that resolves to the IP address of the system.
On many it's just 127.0.0.1 and on some systems it's complete nonsense.
Out of the box, that is.
Many services depend on a proper hostname/IP combo.
User avatar
sander
Release Testers
Release Testers
Posts: 9429
Joined: January 22nd, 2008, 2:22 pm

Re: SAB ignoreing host setting in conf [solved]

Post by sander »

shypike wrote:Hmmm, you're right about the logging, only logging isn't active.
I'll see what I can do.

What I find hard to understand the cavalier approach that Linux distros
have towards setting up a proper node name.
"uname -n" should give a name that resolves to the IP address of the system.
On many it's just 127.0.0.1 and on some systems it's complete nonsense.
Out of the box, that is.
Many services depend on a proper hostname/IP combo.

Is the command: host `uname -n` ?

Here's the result of a few of my systems:


Back to the logging thing:

We should SABnzbd not to solve everything. If a config is bad, SAB can't solve it, I think it's OK if SAB logs it and defaults to something safe (if possible).


Ubuntu laptop:

Code: Select all

sander@R540:~$ host `uname -n`
R540.home has address 192.168.1.53
sander@R540:~$
Raspi:

Code: Select all

pi@raspberrypi ~ $ host `uname -n`
raspberrypi.home has address 192.168.1.50
pi@raspberrypi ~ $ 
Ubuntu Server:

Code: Select all

sander@toverdoos:~$ host `uname -n`
Host toverdoos not found: 3(NXDOMAIN)
sander@toverdoos:~$ 
So my Ubuntu Server is bad?
User avatar
shypike
Administrator
Administrator
Posts: 19773
Joined: January 18th, 2008, 12:49 pm

Re: SAB ignoreing host setting in conf [solved]

Post by shypike »

sander wrote: Ubuntu Server:

Code: Select all

sander@toverdoos:~$ host `uname -n`
Host toverdoos not found: 3(NXDOMAIN)
sander@toverdoos:~$ 
So my Ubuntu Server is bad?
I think so. This is from the manpage of uname:

Code: Select all

 -n, --nodename
              print the network node hostname
AFAIK, a network node name is just that: the name of the network node.
Is it odd that I expect that name to resolve to an IP?
User avatar
sander
Release Testers
Release Testers
Posts: 9429
Joined: January 22nd, 2008, 2:22 pm

Re: SAB ignoreing host setting in conf [solved]

Post by sander »

The ping does know how to handle the `uname -n`:

Code: Select all

sander@toverdoos:~$ ping `uname -n`
PING toverdoos (176.31.156.230) 56(84) bytes of data.
64 bytes from toverdoos (176.31.156.230): icmp_req=1 ttl=64 time=0.041 ms
... so ping does resolve the `uname -n` name.

Luckily python knows it too:

Code: Select all

sander@toverdoos:~$ python
Python 2.7.2+ (default, Oct  4 2011, 20:06:09) 
[GCC 4.6.1] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> print socket.gethostname()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
NameError: name 'socket' is not defined
>>> import socket
>>> socket.gethostname()
'toverdoos'
>>> socket.getaddrinfo(socket.gethostname(), None)
[(2, 1, 6, '', ('176.31.156.230', 0)), (2, 2, 17, '', ('176.31.156.230', 0)), (2, 3, 0, '', ('176.31.156.230', 0))]
>>> 
sander@toverdoos:~$ 

So that works for me, but not for the OP as he had a fancy name which was not in /etc/hosts?

Stupid question: why does SABnzbd want the *name*? Why not just binding to 127.0.0.1, or ::, or ... ?
whytewolf
Newbie
Newbie
Posts: 6
Joined: July 12th, 2012, 1:29 pm

Re: SAB ignoreing host setting in conf [solved]

Post by whytewolf »

shypike wrote:Hmmm, you're right about the logging, only logging isn't active.
I'll see what I can do.

What I find hard to understand the cavalier approach that Linux distros
have towards setting up a proper node name.
"uname -n" should give a name that resolves to the IP address of the system.
On many it's just 127.0.0.1 and on some systems it's complete nonsense.
Out of the box, that is.
Many services depend on a proper hostname/IP combo.
like i said, this is a private server and i was lazy with the hosts file. most services that most people deal with on a day to day basis are happy with an IP address only solution. it is perfectly possible that the address i want to bind to is not the same ip that my hostname qualifies as. in which case why does it matter at all what my system hostname is.
whytewolf
Newbie
Newbie
Posts: 6
Joined: July 12th, 2012, 1:29 pm

Re: SAB ignoreing host setting in conf [solved]

Post by whytewolf »

shypike wrote:
sander wrote: Ubuntu Server:

Code: Select all

sander@toverdoos:~$ host `uname -n`
Host toverdoos not found: 3(NXDOMAIN)
sander@toverdoos:~$ 
So my Ubuntu Server is bad?
I think so. This is from the manpage of uname:

Code: Select all

 -n, --nodename
              print the network node hostname
AFAIK, a network node name is just that: the name of the network node.
Is it odd that I expect that name to resolve to an IP?
it isn't odd that you expect that name is resolved to an IP, it is odd that you ignore a functioning config, because it doesn't.

edit: just thought of something, other network protocols besides IP. such as appletalk, IPX, token-ring. remember these systems were written LONG before IP based networks were the norm. in these cases while it is rare. it could be possible that you do not get an IP address [of coarse. you most likely would not be setting up a ip only based system]
User avatar
shypike
Administrator
Administrator
Posts: 19773
Joined: January 18th, 2008, 12:49 pm

Re: SAB ignoreing host setting in conf [solved]

Post by shypike »

I think I have it fixed now, will be in 0.7.2
Post Reply