Skip to content

Commit

Permalink
CP-46374: Add a minimal observer.py
Browse files Browse the repository at this point in the history
Signed-off-by: Steven Woods <[email protected]>
  • Loading branch information
snwoods authored and psafont committed Jan 24, 2024
1 parent 974de9b commit 5b828c6
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
1 change: 1 addition & 0 deletions scripts/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,7 @@ endif
sed -i 's/#!\/usr\/bin\/python/#!\/usr\/bin\/python3/' $(DESTDIR)$(SITE3_DIR)/XenAPIPlugin.py
$(IDATA) examples/python/XenAPI/XenAPI.py $(DESTDIR)$(SITE3_DIR)/
$(IDATA) examples/python/inventory.py $(DESTDIR)$(SITE3_DIR)/
$(IDATA) observer.py $(DESTDIR)$(SITE3_DIR)/
$(IPROG) examples/python/echo.py $(DESTDIR)$(PLUGINDIR)/echo
$(IPROG) examples/python/shell.py $(DESTDIR)$(LIBEXECDIR)/shell.py
# poweron
Expand Down
15 changes: 15 additions & 0 deletions scripts/observer.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#!/usr/bin/python3

if __name__ == '__main__':
# run a program passed as parameter, with its original arguments
import runpy
import sys

# shift all the argvs one left
sys.argv = sys.argv[1:]
argv0=sys.argv[0]

def run(file):
runpy.run_path(file, run_name='__main__')

run(argv0)

0 comments on commit 5b828c6

Please sign in to comment.