clicon / clixon

YANG-based toolchain including NETCONF and RESTCONF interfaces and an interactive CLI
http://www.clicon.org/
Other
208 stars 70 forks source link

undefined behavior during commit #481

Closed khromenokroman closed 7 months ago

khromenokroman commented 7 months ago

Hello, undefined behavior during commit, I am writing a plugin, I wrote my function, I made a callback for commit_validate as a result, when I commit, I get my function executed 2 times, I can't understand this is how it should be or I did something wrong in the documentation I did not find an answer, thank you

янв 22 21:54:13  systemd[1]: Stopped Clixon backend API service.
янв 22 21:54:13  systemd[1]: Starting Clixon backend API service...
янв 22 21:54:13  clixon_backend[10917]: INIT clixon-plug-useradm version 0.0.5 created
янв 22 21:54:13  clixon_backend[10917]: START clixon-plug-useradm
янв 22 21:54:13 clixon_backend[10919]: clixon_backend: 10919 Started
янв 22 21:54:13 systemd[1]: Started Clixon backend API service.
янв 22 21:54:29  clixon_backend[10919]: Getting users from the configuration...
янв 22 21:54:29 clixon_backend[10919]: 
                                               Username:          admin                                                                                                         
                                               Password Hashed:   7B8873D45A921B2057F3EA1EBB83BF2D5EFF57AC                                                                      
                                               Group:             administrator                                                                                                 
янв 22 21:54:29  clixon_backend[10919]: 
                                               Username:          oper                                                                                                          
                                               Password Hashed:   7B8873D45A921B2057F3EA1EBB83BF2D5EFF57AC                                                                      
                                               Group:             operator                                                                                                      
янв 22 21:54:29 nclixon_backend[10919]: 
                                               Username:          admin                                                                                                         
                                               Password Hashed:   7B8873D45A921B2057F3EA1EBB83BF2D5EFF57AC                                                                      
                                               Group:             system-administrator                                                                                          
янв 22 21:54:29  clixon_backend[10919]: 
                                               Username:          sysadmin                                                                                                      
                                               Password Hashed:   123                                                                                                           
                                               Group:             system-administrator                                                                                          
янв 22 21:54:29 n clixon_backend[10919]: Send data: {"body":"all","context":{"admin":{"password-hashed":"7B8873D45A921B2057F3EA1EBB83BF2D5EFF57AC","role":"system-administrator"},"oper":{"password-hashed":"7B8873D45A921B2057F3EA1EBB83BF2D5EFF57AC","role":"operator"},"sysadmin":{"password-hashed":"123","role":"system-administrator"}}}
янв 22 21:54:29  systemd[1]: Starting Super starter for python clixon_plug_useradm...
янв 22 21:54:29  run_super_py[10925]: Need to start script clixon_plug_useradm with json all for context {'admin': {'password-hashed': '7B8873D45A921B2057F3EA1EBB83BF2D5EFF57AC', 'role': 'system-administrator'}, 'oper': {'password-hashed': '7B8873D45A921B2057F3EA1EBB83BF2D5EFF57AC', 'role': 'operator'}, 'sysadmin': {'password-hashed': '123', 'role': 'system-administrator'}}
янв 22 21:54:29  systemd[1]: sudo_py@clixon_plug_useradm.service: Succeeded.
янв 22 21:54:29 systemd[1]: Finished Super starter for python clixon_plug_useradm.
янв 22 21:54:29  clixon_backend[10919]: Send data is done
янв 22 21:54:29  clixon_backend[10919]: clixon-plug-useradm commit_validate is done
янв 22 21:54:29  clixon_backend[10919]: Getting users from the configuration...
янв 22 21:54:29  clixon_backend[10919]: 
                                               Username:          admin                                                                                                         
                                               Password Hashed:   7B8873D45A921B2057F3EA1EBB83BF2D5EFF57AC                                                                      
                                               Group:             administrator                                                                                                 
янв 22 21:54:29  clixon_backend[10919]: 
                                               Username:          oper                                                                                                          
                                               Password Hashed:   7B8873D45A921B2057F3EA1EBB83BF2D5EFF57AC                                                                      
                                               Group:             operator                                                                                                      
янв 22 21:54:29  clixon_backend[10919]: 
                                               Username:          admin                                                                                                         
                                               Password Hashed:   7B8873D45A921B2057F3EA1EBB83BF2D5EFF57AC                                                                      
                                               Group:             system-administrator                                                                                          
янв 22 21:54:29  clixon_backend[10919]: 
                                               Username:          sysadmin                                                                                                      
                                               Password Hashed:   123                                                                                                           
                                               Group:             system-administrator                                                                                          
янв 22 21:54:29  clixon_backend[10919]: Send data: {"body":"all","context":{"admin":{"password-hashed":"7B8873D45A921B2057F3EA1EBB83BF2D5EFF57AC","role":"system-administrator"},"oper":{"password-hashed":"7B8873D45A921B2057F3EA1EBB83BF2D5EFF57AC","role":"operator"},"sysadmin":{"password-hashed":"123","role":"system-administrator"}}}
янв 22 21:54:29  systemd[1]: Starting Super starter for python clixon_plug_useradm...
янв 22 21:54:29  run_super_py[10927]: Need to start script clixon_plug_useradm with json all for context {'admin': {'password-hashed': '7B8873D45A921B2057F3EA1EBB83BF2D5EFF57AC', 'role': 'system-administrator'}, 'oper': {'password-hashed': '7B8873D45A921B2057F3EA1EBB83BF2D5EFF57AC', 'role': 'operator'}, 'sysadmin': {'password-hashed': '123', 'role': 'system-administrator'}}
янв 22 21:54:29  systemd[1]: sudo_py@clixon_plug_useradm.service: Succeeded.
янв 22 21:54:29  systemd[1]: Finished Super starter for python clixon_plug_useradm.
янв 22 21:54:29  clixon_backend[10919]: Send data is done
янв 22 21:54:29  clixon_backend[10919]: clixon-plug-useradm commit_validate is done

In this example, I transfer what I received in the transaction to my python script, it doesn't matter, the question is that the commit works 2 times, what is it related to? tell me

khromenokroman commented 7 months ago

https://github.com/clicon/clixon/issues/488 I have added more details