Example #1
0
 def __init__(self, dryrun=False):
     print "Fetching people from phonebook..."
     if dryrun:
         people_json = (get_project_root_path()
                        + '/auto_nag/tests/people.json')
         with open(people_json, 'r') as pj:
             self.people = json.load(pj)
     else:
         config = get_config_path()
         config = json.load(open(config, 'r'))
         self.people = json.loads(requests.get(PEOPLE_URL,
                                               auth=(config['ldap_username'],
                                                     config['ldap_password'])).content)
     self.people_by_bzmail = self.get_people_by_bzmail()
     self.managers = self.get_managers()
     self.vices = self.get_vices()
Example #2
0
 def __init__(self, dryrun=False):
     print "Fetching people from phonebook..."
     if dryrun:
         people_json = (get_project_root_path() +
                        '/auto_nag/tests/people.json')
         with open(people_json, 'r') as pj:
             self.people = json.load(pj)
     else:
         config = get_config_path()
         config = json.load(open(config, 'r'))
         self.people = json.loads(
             requests.get(PEOPLE_URL,
                          auth=(config['ldap_username'],
                                config['ldap_password'])).content)
     self.people_by_bzmail = self.get_people_by_bzmail()
     self.managers = self.get_managers()
     self.vices = self.get_vices()

def cleanUp(queries_dir):
    try:
        for file in os.listdir(queries_dir):
            if file.startswith(str(datetime.date.today())):
                os.remove(os.path.join(queries_dir, file))
        return True
    except Exception as error:
        print "Error: ", str(error)
        return False


if __name__ == '__main__':
    # basic setups
    CONFIG_JSON = get_config_path()
    config = json.load(open(CONFIG_JSON, 'r'))
    scripts_dir = get_project_root_path() + "auto_nag/scripts/"
    queries_dir = get_project_root_path() + "queries/"

    parser = ArgumentParser(__doc__)
    parser.set_defaults(queries_only=False, )
    parser.add_argument("-q",
                        "--queries-only",
                        dest="queries_only",
                        action="store_true",
                        help="just create and print queries")

    options, args = parser.parse_known_args()
    weekday = datetime.datetime.today().weekday()
    queries = createQueriesList(queries_dir,
Example #4
0
 def test_get_config_path(self):
     cpath = get_config_path()
     # remove 'not' when running locally
     # 'not' helps to pass CI checks while commiting
     assert not os.path.exists(cpath)
    (1, ["Koi Blocking Nominiations for B2G: Media", "team_media_koi_nom", team_media_koi_nom, 1, ["*****@*****.**", ]]),
    (1, ["Koi Blocker Bugs, B2G: Media", "team_media_koi_blockers", team_media_koi_blockers, 1, ["*****@*****.**", ]]),
    (1, ["Koi Blocking Nominiations for B2G: Communications", "team_comm_koi_nom", team_comm_koi_nom, 1, ["*****@*****.**", ]]),
    (1, ["Koi Blocker Bugs, B2G: Communications", "team_comm_koi_blockers", team_comm_koi_blockers, 1, ["*****@*****.**", ]]),
    (4, ["Koi Blocker Bugs, No Comment from Assignee in 3 days or more", "koi_assignee_no_comment_three_days", koi_assignee_no_comment_three_days, 1]),
    (4, ["Koi Blocker Bugs, Regressions", "koi_regressions_unfixed", koi_regressions_unfixed, 1]),
]


def cleanUp():
    for file in os.listdir(queries_dir):
        if file.startswith(str(datetime.date.today())):
            os.remove(os.path.join(queries_dir, file))

if __name__ == '__main__':
    CONFIG_JSON = get_config_path()
    config = json.load(open(CONFIG_JSON, 'r'))
    scripts_dir = get_project_root_path() + "auto_nag/scripts/"
    queries_dir = get_project_root_path() + "queries/"
    parser = ArgumentParser(__doc__)
    parser.set_defaults(
        queries_only=False,
    )
    parser.add_argument("-q", "--queries-only", dest="queries_only", action="store_true",
                        help="just create and print queries")

    options, args = parser.parse_known_args()
    queries = createQueriesList(print_all=options.queries_only,
                                queries_dir=queries_dir)

    if options.queries_only:
Example #6
0
def get_private():
    with open(get_config_path(), 'r') as In:
        return json.load(In)['private']
Example #7
0
def get_login_info():
    with open(get_config_path(), 'r') as In:
        return json.load(In)
Example #8
0
def get_private():
    with open(get_config_path(), 'r') as In:
        return json.load(In)['private']
Example #9
0
def get_login_info():
    with open(get_config_path(), 'r') as In:
        return json.load(In)
Example #10
0
 def test_get_config_path(self):
     cpath = get_config_path()
     # remove 'not' when running locally
     # 'not' helps to pass CI checks while commiting
     assert not os.path.exists(cpath)