Ejemplo n.º 1
0
 def get(self):
     project_name = request.args.get('project_name')
     if project_name:
         project = ProjectInfo()
         result = project.get_format_projectplan(project_name)
         if result:
             logger("INFO", "get project plan successfully")
             return {
                 "code": 0,
                 "message": "get project plan successfully!",
                 "data": result
             }
         else:
             logger("INFO", "get project planfailed")
             return {
                 "code":
                 1,
                 "message":
                 "Can not find the information about {}!".format(
                     project_name),
                 "data":
                 result
             }
     else:
         logger("INFO", "get project plan failed")
         return {
             "code": 1,
             "message": "The input of project_name is None",
             "data": None
         }
Ejemplo n.º 2
0
 def get(self):
     project_name = request.args.get('project_name')
     logger("INFO", "project name is %s" % project_name)
     pro_info = ProjectInfo()
     project_info = pro_info.get_projectname_info(project_name)
     logger(
         "INFO",
         "start to get the information of this projectname by restful api")
     logger("INFO", "the information of project is %s" % project_info)
     if project_info:
         logger(
             "INFO",
             "get the information of this project name by restful api successfully"
         )
         return {
             "code": 0,
             "message":
             "get the information of this projectname successfully!",
             "data": project_info
         }
     else:
         logger("INFO",
                "information about this project name could not be find")
         return {
             "code": 1,
             "message": "This project name is not exit!",
             "data": project_info
         }
Ejemplo n.º 3
0
 def get(self):
     pro_info = ProjectInfo()
     progress_project = pro_info.filter_progress_prj()
     logger("INFO", "start statistical information by restful api")
     logger(
         "INFO",
         "the information of project in progress is %s" % progress_project)
     if progress_project is not None:
         logger(
             "INFO",
             "get the information of process project from excel content by restful api successfully"
         )
         return {
             "code": 0,
             "message":
             "get the information of in progress project successfully!",
             "data": progress_project
         }
     else:
         logger("WARN", " the information of project in progress is null")
         return {
             "code": 1,
             "message":
             "get the information of in progress project failed!",
             "data": progress_project
         }
Ejemplo n.º 4
0
def find_project(project_name):
    """通过项目名找到bugzilla和testlink上的项目名"""
    # 通过项目名找到项目id
    if project_name == u"i-stack智慧城市操作系统(二期)":
        real_project = "i-stack"
    else:
        pp = ProjectInfo()
        project_id = pp.get_projectid(project_name)
        real_project = project_id.replace("2019", "19")
    return real_project
Ejemplo n.º 5
0
def find_gerrit_project(project_name):
    """通过项目名找到gerrit上的项目名"""
    if project_name == u"i-stack智慧城市操作系统(二期)":
        project_name = "istack-pike"
        return project_name
    try:
        # 返回项目名对应的项目id,gerrit中2019年项目以项目id_xxx的方式命名
        pp = ProjectInfo()
        project_id = pp.get_projectid(project_name)
        return project_id
    except:
        # 若项目名在项目概况的excel中不存在,直接返回项目名
        return project_name
Ejemplo n.º 6
0
 def get(self):
     pro_info = ProjectInfo()
     names = pro_info.get_names()
     if names:
         logger("INFO", "the names of all project is %s" % names)
         logger("INFO", "get all project names successfully!")
         return {
             "code": 0,
             "message": "get all project names successfully!",
             "data": names
         }
     else:
         logger("INFO", "get all project names failed")
         return {
             "code": 1,
             "message":
             "the information return by the method get_names() is None",
             "data": None
         }
Ejemplo n.º 7
0
 def get(self):
     pro_info = ProjectInfo()
     stage_num = pro_info.statistical_stage_num()
     if stage_num is not None:
         logger(
             "INFO",
             "get the number of stage and status by restful api successfully"
         )
         return {
             "code": 0,
             "message":
             "Count the number of stage and status  successfully!",
             "data": stage_num
         }
     else:
         logger("WARN", "the information of stage and status is null")
         return {
             "code": 1,
             "message": "Count the number of stage and status  failed!",
             "data": stage_num
         }
Ejemplo n.º 8
0
 def get(self):
     project = ProjectInfo()
     status = request.args.get('status')
     days = request.args.get('days')
     if status and days == None:
         if status == "异常":
             unusual_project = project.get_unusual_project()
             logger("INFO", "get unusual project information successfully")
             return {
                 "code": 0,
                 "message": "get unusual project information successfully!",
                 "data": unusual_project
             }
         elif status == "提醒":
             # 不带天数,默认返回7天的
             default_days = 7
             remind_project = project.get_remind_project(default_days)
             logger("INFO", "get remind project information successfully")
             return {
                 "code": 0,
                 "message": "get remind project information successfully!",
                 "data": remind_project
             }
     elif status == "提醒" and days != None:
         remind_project = project.get_remind_project(days)
         logger("INFO", "get remind project information successfully")
         return {
             "code": 0,
             "message": "get remind project information successfully!",
             "data": remind_project
         }
     else:
         logger("INFO", "get status information failed")
         return {
             "code": 1,
             "message": "The input of status is False",
             "data": None
         }
Ejemplo n.º 9
0
 def get(self):
     project_name = request.args.get('project_name')
     if not project_name:
         logger("INFO", "It have not project_name argument")
         return {"code": 1, "message": "project_name argument is not exist"}
     logger("INFO", "start to get document by restful api")
     logger("INFO", "project name is %s" % project_name)
     project = ProjectInfo()
     project_id = project.get_projectid(project_name)
     if project_id is None:
         logger("WARN", "project %s is not exist!" % project_name)
         return {"code": 1, "message": "project is not exist"}
     folder_path = os.path.join(project.local_dir,
                                project_id + "_" + project_name)
     if not os.path.isdir(folder_path):
         logger("WARN", "folder %s is not exist!" % folder_path)
         return {"code": 1, "message": "project folder is not exist"}
     docinfo = project.get_doc_tree(folder_path)
     logger("INFO", "get document by restful api successfully")
     return {
         "code": 0,
         "message": "get project document successfully!",
         "data": docinfo
     }
Ejemplo n.º 10
0
#
#         http://www.apache.org/licenses/LICENSE-2.0
#
#    Unless required by applicable law or agreed to in writing, software
#    distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
#    WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
#    License for the specific language governing permissions and limitations
#    under the License.
#
# Author: [email protected]
# Date:   July 2018

"""
@file time_task.py
"""

from insert_mongo_data import *
from document import ProjectInfo
import sys
reload(sys)
sys.setdefaultencoding('utf-8')

pr = ProjectInfo()
pr.get_svn_doc()
all_project_bug()
all_bug_history()
all_bug_content()
testlink_to_mongodb()
gerrit_to_mognodb()