#!/usr/bin/python

#####################################################################
#                                                                   #
#                   FIXME                                           #
#                                                                   #
#  this is just for development, not to be used really              #
#                                                                   #
#  the functionalities of this script will be included              #
#  in /usr/bin/oasis                                                #
#                                                                   #
#  The point of this script is to run probes and nothing else       #
#                                                                   #
#####################################################################

import getopt
import os
import sys
import time

from oasispackage.oasisAPI import oasisCLI, FlagFile


# # FIXME
# # if the daemon is running, 
# # how to prevent to run probes and publish itself
# # in parallel ???
# #
# # The solution would be to run the probes without a flagfile,
# # or a flagfile in a place the daemon does not find it.
# 
# def main():
# 
#     oasis = oasisCLI()
# 
#     projectname = oasis.project.projectname
# 
#     flag = FlagFile(projectname)
#     flag.create()
# 
#     oasis.project._checkflagfile()  # temporary solution ?
# 
#     rc = oasis.project.runprobes()
#     # FIXME
#     # to make this work I had to modify runprobes()
#     # If user is root, calls the probes with sudo
#     # If user is regular user (the one running this script), calls the probes normally
# 
#     return rc


def main():

    oasis = oasisCLI()

    projectname = oasis.project.projectname

    flag = FlagFile(projectname)

    # we force the creation of the flagfile in a random directory underneath /tmp/
    # just in case the daemon is also running.
    # This flag file is hidden to the daemon, so it is not going to trigger
    # running probes and publishing in parallel
    import tempfile
    flag.basedir = tempfile.mkdtemp(dir='/tmp/')
    flag.create()
    oasis.project.flagfile = flag 

    rc = oasis.project.runprobes()
    # FIXME
    # to make this work I had to modify runprobes()
    # If user is root, calls the probes with sudo
    # If user is regular user (the one running this script), calls the probes normally

    # now delete the flagfile and the random directory
    os.remove(flag.flagfile)
    os.rmdir(flag.basedir)

    return rc


if __name__ == '__main__':
    rc = main()
    sys.exit(rc)

1545eb99d54fa8a0dea188f58731862b93cedf61
<mask token>

<mask token>


def main():
    oasis = oasisCLI()
    projectname = oasis.project.projectname
    flag = FlagFile(projectname)
    import tempfile
    flag.basedir = tempfile.mkdtemp(dir='/tmp/')
    flag.create()
    oasis.project.flagfile = flag
    rc = oasis.project.runprobes()
    os.remove(flag.flagfile)
    os.rmdir(flag.basedir)
    return rc


<mask token>

<mask token>


def main():
    oasis = oasisCLI()
    projectname = oasis.project.projectname
    flag = FlagFile(projectname)
    import tempfile
    flag.basedir = tempfile.mkdtemp(dir='/tmp/')
    flag.create()
    oasis.project.flagfile = flag
    rc = oasis.project.runprobes()
    os.remove(flag.flagfile)
    os.rmdir(flag.basedir)
    return rc


if __name__ == '__main__':
    rc = main()
    sys.exit(rc)

import getopt
import os
import sys
import time
from oasispackage.oasisAPI import oasisCLI, FlagFile


def main():
    oasis = oasisCLI()
    projectname = oasis.project.projectname
    flag = FlagFile(projectname)
    import tempfile
    flag.basedir = tempfile.mkdtemp(dir='/tmp/')
    flag.create()
    oasis.project.flagfile = flag
    rc = oasis.project.runprobes()
    os.remove(flag.flagfile)
    os.rmdir(flag.basedir)
    return rc


if __name__ == '__main__':
    rc = main()
    sys.exit(rc)

#!/usr/bin/python

#####################################################################
#                                                                   #
#                   FIXME                                           #
#                                                                   #
#  this is just for development, not to be used really              #
#                                                                   #
#  the functionalities of this script will be included              #
#  in /usr/bin/oasis                                                #
#                                                                   #
#  The point of this script is to run probes and nothing else       #
#                                                                   #
#####################################################################

import getopt
import os
import sys
import time

from oasispackage.oasisAPI import oasisCLI, FlagFile


# # FIXME
# # if the daemon is running, 
# # how to prevent to run probes and publish itself
# # in parallel ???
# #
# # The solution would be to run the probes without a flagfile,
# # or a flagfile in a place the daemon does not find it.
# 
# def main():
# 
#     oasis = oasisCLI()
# 
#     projectname = oasis.project.projectname
# 
#     flag = FlagFile(projectname)
#     flag.create()
# 
#     oasis.project._checkflagfile()  # temporary solution ?
# 
#     rc = oasis.project.runprobes()
#     # FIXME
#     # to make this work I had to modify runprobes()
#     # If user is root, calls the probes with sudo
#     # If user is regular user (the one running this script), calls the probes normally
# 
#     return rc


def main():

    oasis = oasisCLI()

    projectname = oasis.project.projectname

    flag = FlagFile(projectname)

    # we force the creation of the flagfile in a random directory underneath /tmp/
    # just in case the daemon is also running.
    # This flag file is hidden to the daemon, so it is not going to trigger
    # running probes and publishing in parallel
    import tempfile
    flag.basedir = tempfile.mkdtemp(dir='/tmp/')
    flag.create()
    oasis.project.flagfile = flag 

    rc = oasis.project.runprobes()
    # FIXME
    # to make this work I had to modify runprobes()
    # If user is root, calls the probes with sudo
    # If user is regular user (the one running this script), calls the probes normally

    # now delete the flagfile and the random directory
    os.remove(flag.flagfile)
    os.rmdir(flag.basedir)

    return rc


if __name__ == '__main__':
    rc = main()
    sys.exit(rc)
