backend.doflow_discover.main()   A
last analyzed

Complexity

Conditions 1

Size

Total Lines 12
Code Lines 9

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 9
nop 0
dl 0
loc 12
rs 9.95
c 0
b 0
f 0
1
'''do the discovery workflow, but bypassing the queue'''
2
3
#do not remove! needed
4
import json #pylint: disable=unused-import
5
from helpers.networkhelper import networkmap
6
from backend.fcmapp import ApplicationService
7
from backend.doflow_handlemessages import dispatchmessages
8
from backend.when_discover import findminers
9
10
def main():
11
    mainapp = ApplicationService(component='discover', option='')
12
13
    mainapp.cache.purge()
14
15
    #this is the discovery process
16
    hosts_list = networkmap(mainapp.configuration.get('discover.dns'), \
17
        mainapp.configuration.get('discover.minerport'), \
18
        mainapp.configuration.get('discover.sshport'))
19
    discoveredentries = findminers(hosts_list, mainapp.knownminers())
20
    dispatchmessages(mainapp, discoveredentries)
21
    print('done')
22
23
24
if __name__ == "__main__":
25
    main()
26