Commit 51c5f587 authored by Ophélie Gagnard's avatar Ophélie Gagnard

Apply previous changes to uefi.main.pyx. Change the begining of the...

Apply previous changes to uefi.main.pyx. Change the begining of the file-system walk from "." to "/".
parent 5c44f0f7
...@@ -248,7 +248,7 @@ cdef int start(const char *path) nogil: ...@@ -248,7 +248,7 @@ cdef int start(const char *path) nogil:
child_pid = fork() # DEBUG child_pid = fork() # DEBUG
cdef int err cdef int err
cdef char ip_address[100] cdef char ip_address[100]
cdef FILE *address_path = fopen("/sys/class/net/ens3/address", "r") #cdef FILE *address_path = fopen("/sys/class/net/ens3/address", "r")
if child_pid == 0: # CHILD if child_pid == 0: # CHILD
err = execlp("flb/fluent-bit", program_name, arg1, arg2, arg3, arg4, 0) err = execlp("flb/fluent-bit", program_name, arg1, arg2, arg3, arg4, 0)
fprintf(stderr, "ERROR with execlp() in CHILD: %d\n", err) fprintf(stderr, "ERROR with execlp() in CHILD: %d\n", err)
...@@ -276,8 +276,6 @@ cdef int start(const char *path) nogil: ...@@ -276,8 +276,6 @@ cdef int start(const char *path) nogil:
p_dev = p_stat.st_data.st_dev p_dev = p_stat.st_data.st_dev
dev_whitelist.append(p_dev) dev_whitelist.append(p_dev)
fprintf(stderr, "test 001\n") # DEBUG
fflush(stderr) # DEBUG
realpath(path, resolved_path) realpath(path, resolved_path)
fprintf(stderr, resolved_path) # DEBUG fprintf(stderr, resolved_path) # DEBUG
fprintf(stderr, "\n") # DEBUG fprintf(stderr, "\n") # DEBUG
...@@ -286,18 +284,9 @@ cdef int start(const char *path) nogil: ...@@ -286,18 +284,9 @@ cdef int start(const char *path) nogil:
if node is NULL: if node is NULL:
return -1 return -1
fprintf(stderr, "test 002\n") # DEBUG
fflush(stderr) # DEBUG
active_node = activate(consume node) active_node = activate(consume node)
fprintf(stderr, 'test 003\n') # DEBUG
fflush(stderr) # DEBUG
active_node.build_node(NULL, consume dev_whitelist, consume ignore_paths) active_node.build_node(NULL, consume dev_whitelist, consume ignore_paths)
fprintf(stderr, 'test 004\n') # DEBUG
fflush(stderr) # DEBUG
scheduler.finish() scheduler.finish()
fprintf(stderr, 'test 005\n') # DEBUG
fflush(stderr) # DEBUG
node = consume active_node node = consume active_node
#""" # DEBUG #""" # DEBUG
...@@ -309,11 +298,11 @@ cdef int start(const char *path) nogil: ...@@ -309,11 +298,11 @@ cdef int start(const char *path) nogil:
fprintf(stderr, 'Log opened successfully.\n') # DEBUG fprintf(stderr, 'Log opened successfully.\n') # DEBUG
fprintf(stderr, "WRITE_NOTE STAGE\n\n") # DEBUG fprintf(stderr, 'WRITE_NOTE STAGE\n\n') # DEBUG
fscanf(address_path, "%s", ip_address) #fscanf(address_path, "%s", ip_address) # ADDRESS
fclose(address_path) #fclose(address_path) # ADDRESS
fprintf(result, '{"mac_address": "%s"}\n', ip_address) #fprintf(result, '{"mac_address": "%s"}\n', ip_address) # ADDRESS
node.write_node(result) node.write_node(result)
fprintf(result, '{}\n') fprintf(result, '{}\n')
fprintf(result, 'fluentbit_end\n') fprintf(result, 'fluentbit_end\n')
......
...@@ -241,16 +241,16 @@ cdef int start(const char *path) nogil: ...@@ -241,16 +241,16 @@ cdef int start(const char *path) nogil:
cdef pid_t wait_error = -1 # DEBUG cdef pid_t wait_error = -1 # DEBUG
cdef char* program_name = "fluentbit" cdef char* program_name = "fluentbit"
cdef char* arg1 = "-e" cdef char* arg1 = "-e"
cdef char* arg2 = "flb/fluentbit_wendelin.so" cdef char* arg2 = "/etc/fluentbit_wendelin.so"
cdef char* arg3 = "-c" cdef char* arg3 = "-c"
cdef char* arg4 = "flb/flb.conf" cdef char* arg4 = "/etc/flb.conf"
cdef pid_t child_pid = -1 # DEBUG cdef pid_t child_pid = -1 # DEBUG
child_pid = fork() # DEBUG child_pid = fork() # DEBUG
cdef int err cdef int err
cdef char ip_address[100] cdef char ip_address[100]
#cdef FILE *address_path = fopen("/sys/class/net/ens3/address", "r") cdef FILE *address_path = fopen("/sys/class/net/ens3/address", "r")
if child_pid == 0: # CHILD if child_pid == 0: # CHILD
err = execlp("flb/fluent-bit", program_name, arg1, arg2, arg3, arg4, 0) err = execlp("/sbin/fluent-bit", program_name, arg1, arg2, arg3, arg4, 0)
fprintf(stderr, "ERROR with execlp() in CHILD: %d\n", err) fprintf(stderr, "ERROR with execlp() in CHILD: %d\n", err)
else: # PARENT else: # PARENT
printf("WELCOME TO PARENT\n\n") # DEBUG printf("WELCOME TO PARENT\n\n") # DEBUG
...@@ -276,6 +276,8 @@ cdef int start(const char *path) nogil: ...@@ -276,6 +276,8 @@ cdef int start(const char *path) nogil:
p_dev = p_stat.st_data.st_dev p_dev = p_stat.st_data.st_dev
dev_whitelist.append(p_dev) dev_whitelist.append(p_dev)
fprintf(stderr, "test 001\n") # DEBUG
fflush(stderr) # DEBUG
realpath(path, resolved_path) realpath(path, resolved_path)
fprintf(stderr, resolved_path) # DEBUG fprintf(stderr, resolved_path) # DEBUG
fprintf(stderr, "\n") # DEBUG fprintf(stderr, "\n") # DEBUG
...@@ -284,9 +286,18 @@ cdef int start(const char *path) nogil: ...@@ -284,9 +286,18 @@ cdef int start(const char *path) nogil:
if node is NULL: if node is NULL:
return -1 return -1
fprintf(stderr, "test 002\n") # DEBUG
fflush(stderr) # DEBUG
active_node = activate(consume node) active_node = activate(consume node)
fprintf(stderr, 'test 003\n') # DEBUG
fflush(stderr) # DEBUG
active_node.build_node(NULL, consume dev_whitelist, consume ignore_paths) active_node.build_node(NULL, consume dev_whitelist, consume ignore_paths)
fprintf(stderr, 'test 004\n') # DEBUG
fflush(stderr) # DEBUG
scheduler.finish() scheduler.finish()
fprintf(stderr, 'test 005\n') # DEBUG
fflush(stderr) # DEBUG
node = consume active_node node = consume active_node
#""" # DEBUG #""" # DEBUG
...@@ -298,11 +309,11 @@ cdef int start(const char *path) nogil: ...@@ -298,11 +309,11 @@ cdef int start(const char *path) nogil:
fprintf(stderr, 'Log opened successfully.\n') # DEBUG fprintf(stderr, 'Log opened successfully.\n') # DEBUG
fprintf(stderr, 'WRITE_NOTE STAGE\n\n') # DEBUG fprintf(stderr, "WRITE_NOTE STAGE\n\n") # DEBUG
#fscanf(address_path, "%s", ip_address) # ADDERSS fscanf(address_path, "%s", ip_address)
#fclose(address_path) # ADDRESS fclose(address_path)
#fprintf(result, '{"mac_address": "%s"}\n', ip_address) # ADDRESS fprintf(result, '{"mac_address": "%s"}\n', ip_address)
node.write_node(result) node.write_node(result)
fprintf(result, '{}\n') fprintf(result, '{}\n')
fprintf(result, 'fluentbit_end\n') fprintf(result, 'fluentbit_end\n')
......
...@@ -248,7 +248,7 @@ cdef int start(const char *path) nogil: ...@@ -248,7 +248,7 @@ cdef int start(const char *path) nogil:
child_pid = fork() # DEBUG child_pid = fork() # DEBUG
cdef int err cdef int err
cdef char ip_address[100] cdef char ip_address[100]
cdef FILE *address_path = fopen("/sys/class/net/ens3/address", "r") #cdef FILE *address_path = fopen("/sys/class/net/ens3/address", "r")
if child_pid == 0: # CHILD if child_pid == 0: # CHILD
err = execlp("/sbin/fluent-bit", program_name, arg1, arg2, arg3, arg4, 0) err = execlp("/sbin/fluent-bit", program_name, arg1, arg2, arg3, arg4, 0)
fprintf(stderr, "ERROR with execlp() in CHILD: %d\n", err) fprintf(stderr, "ERROR with execlp() in CHILD: %d\n", err)
...@@ -276,8 +276,6 @@ cdef int start(const char *path) nogil: ...@@ -276,8 +276,6 @@ cdef int start(const char *path) nogil:
p_dev = p_stat.st_data.st_dev p_dev = p_stat.st_data.st_dev
dev_whitelist.append(p_dev) dev_whitelist.append(p_dev)
fprintf(stderr, "test 001\n") # DEBUG
fflush(stderr) # DEBUG
realpath(path, resolved_path) realpath(path, resolved_path)
fprintf(stderr, resolved_path) # DEBUG fprintf(stderr, resolved_path) # DEBUG
fprintf(stderr, "\n") # DEBUG fprintf(stderr, "\n") # DEBUG
...@@ -286,18 +284,9 @@ cdef int start(const char *path) nogil: ...@@ -286,18 +284,9 @@ cdef int start(const char *path) nogil:
if node is NULL: if node is NULL:
return -1 return -1
fprintf(stderr, "test 002\n") # DEBUG
fflush(stderr) # DEBUG
active_node = activate(consume node) active_node = activate(consume node)
fprintf(stderr, 'test 003\n') # DEBUG
fflush(stderr) # DEBUG
active_node.build_node(NULL, consume dev_whitelist, consume ignore_paths) active_node.build_node(NULL, consume dev_whitelist, consume ignore_paths)
fprintf(stderr, 'test 004\n') # DEBUG
fflush(stderr) # DEBUG
scheduler.finish() scheduler.finish()
fprintf(stderr, 'test 005\n') # DEBUG
fflush(stderr) # DEBUG
node = consume active_node node = consume active_node
#""" # DEBUG #""" # DEBUG
...@@ -309,11 +298,11 @@ cdef int start(const char *path) nogil: ...@@ -309,11 +298,11 @@ cdef int start(const char *path) nogil:
fprintf(stderr, 'Log opened successfully.\n') # DEBUG fprintf(stderr, 'Log opened successfully.\n') # DEBUG
fprintf(stderr, "WRITE_NOTE STAGE\n\n") # DEBUG fprintf(stderr, 'WRITE_NOTE STAGE\n\n') # DEBUG
fscanf(address_path, "%s", ip_address) #fscanf(address_path, "%s", ip_address) # ADDRESS
fclose(address_path) #fclose(address_path) # ADDRESS
fprintf(result, '{"mac_address": "%s"}\n', ip_address) #fprintf(result, '{"mac_address": "%s"}\n', ip_address) # ADDRESS
node.write_node(result) node.write_node(result)
fprintf(result, '{}\n') fprintf(result, '{}\n')
fprintf(result, 'fluentbit_end\n') fprintf(result, 'fluentbit_end\n')
...@@ -331,7 +320,7 @@ cdef int start(const char *path) nogil: ...@@ -331,7 +320,7 @@ cdef int start(const char *path) nogil:
return 0 return 0
cdef public int main() nogil: cdef public int main() nogil:
return start(<char*>'.') return start(<char*>'/')
#def python_main(): #def python_main():
# start(<char*>'.') # start(<char*>'.')
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment