from common.utils import sync
from common.git_obs_mapping import GitObsMapping
from common.git import clone_gitproject
+from jenkinsapi.jenkins import Jenkins
#================================================================================
# generate_mapping()
#exit(0)
###########################################################
+# if next job exists, just return.
+jenkins = Jenkins(os.getenv("JENKINS_URL"),
+ os.getenv("OBS_API_USERNAME"),
+ os.getenv("OBS_API_PASSWD"))
+job = os.getenv('JOB_NAME')
+
+url = os.path.join(os.getenv("JENKINS_URL"),
+ "job",
+ job,
+ "api/python")
+job_data = jenkins.get_data(url)
+if job_data["queueItem"] is not None:
+ print "Another queued job exists. exiting..."
+ exit(0)
+
+###########################################################
# main
WORKSPACE = os.getenv('WORKSPACE', '.')
MAPPING_PRJ = os.getenv("MAPPING_PRJ", "scm/git-obs-mapping")