elviejokike / flask-eureka

Flask Eureka Integration
MIT License
25 stars 18 forks source link

Configuration won't load #9

Closed Freezor closed 4 years ago

Freezor commented 6 years ago

Hi,

I got a running Spring Netflix Eureka Server and tried to connect a flask client to it. When I try to start the Flask Server I get the following error message and I can't find out where the error is.

Der Befehl ""ifconfig en0 | grep 'inet addr' | awk '{ print $2 }'"" ist entweder falsch geschrieben oder
konnte nicht gefunden werden.
Traceback (most recent call last):
  File "C:/Projects/PDA/web-crawler-service/webcrawlerservice/WebCrawlerService.py", line 62, in <module>
    connect_to_eureka()
  File "C:/Projects/PDA/web-crawler-service/webcrawlerservice/WebCrawlerService.py", line 33, in connect_to_eureka
    eureka.register_service(name="my-flask-service")
  File "C:\Projects\playground\venv1\lib\site-packages\flask_eureka\eureka.py", line 57, in register_service
    **kwargs)
  File "C:\Projects\playground\venv1\lib\site-packages\flask_eureka\eurekaclient.py", line 95, in __init__
    host_info = HostInfo().get()
  File "C:\Projects\playground\venv1\lib\site-packages\flask_eureka\hostinfo.py", line 34, in get
    'IPv4': self.ipv4(),
  File "C:\Projects\playground\venv1\lib\site-packages\flask_eureka\hostinfo.py", line 52, in ipv4
    ipv4 = getoutput("ifconfig " + self.iface + " | grep 'inet addr' | awk '{ print $2 }'")
  File "C:\Projects\playground\venv1\lib\site-packages\flask_eureka\hostinfo.py", line 10, in getoutput
    return subprocess.check_output([cmd], shell=True)
  File "C:\Python27\Lib\subprocess.py", line 219, in check_output
    raise CalledProcessError(retcode, cmd, output=output)
subprocess.CalledProcessError: Command '["ifconfig en0 | grep 'inet addr' | awk '{ print $2 }'"]' returned non-zero exit status 1

Attached you can find my configuration file and the python script which I am running.

My Spring Eureka Server has the following configuration:

spring:
  application:
    name: eureka-service
server:
  port: 8761
eureka:
  client:
    registerWithEureka: false
    fetchRegistry: false
    serviceUrl:
      defaultZone: http://localhost:8761/

Thanks

webcrawlerservice.zip

Freezor commented 5 years ago

I found the line with the problem: ipv4 = ipv4.split(':')[1] Line 53 in hostinfo.py.

I get an array Index out of bounds exception

rainkidpk commented 4 years ago

hello, you fixed it?

Freezor commented 4 years ago

Yes. And I created a PullRequest to share my fix

Freezor commented 4 years ago

Fixed by Pullrequest #11