def __init__(self, *args, **kw): super(MegaplanService, self).__init__(*args, **kw) self.hostname = self.config_get('hostname') _login = self.config_get('login') _password = self.config_get_password('password', _login) self.client = megaplan.Client(self.hostname) self.client.authenticate(_login, _password) self.project_name = self.config_get_default('project_name', self.hostname)
def __init__(self, *args, **kw): super(MegaplanService, self).__init__(*args, **kw) self.hostname = self.config.get(self.target, 'hostname') _login = self.config.get(self.target, 'login') _password = self.config.get(self.target, 'password') self.client = megaplan.Client(self.hostname) self.client.authenticate(_login, _password) self.project_name = self.hostname if self.config.has_option(self.target, "project_name"): self.project_name = self.config.get(self.target, "project_name")
def __init__(self, *args, **kw): super(MegaplanService, self).__init__(*args, **kw) self.hostname = self.config_get('hostname') _login = self.config_get('login') _password = self.config_get('password') if not _password or _password.startswith("@oracle:"): _password = get_service_password( self.get_keyring_service(self.config, self.target), _login, oracle=_password, interactive=self.config.interactive) self.client = megaplan.Client(self.hostname) self.client.authenticate(_login, _password) self.project_name = self.config_get_default('project_name', self.hostname)
def __init__(self, *args, **kw): super(MegaplanService, self).__init__(*args, **kw) self.hostname = self.config.get(self.target, 'hostname') _login = self.config.get(self.target, 'login') _password = self.config.get(self.target, 'password') if not _password or _password.startswith("@oracle:"): service = "megaplan://%s@%s" % (_login, self.hostname) _password = get_service_password( service, _login, oracle=_password, interactive=self.config.interactive) self.client = megaplan.Client(self.hostname) self.client.authenticate(_login, _password) self.project_name = self.hostname if self.config.has_option(self.target, "project_name"): self.project_name = self.config.get(self.target, "project_name")
def get_project_issues(self): issues = {} c = megaplan.Client(self.settings['host'], self.settings['access_id'], self.settings['secret_key']) for task in c.get_tasks_by_status( status='status' in self.settings and self.settings['status'] or 'inprocess'): issue = { 'id': task['Id'], 'url': 'https://%s/task/%s/card/' % (c.hostname, task['Id']), 'subject': task['Name'], 'description': c.get_task_details(task['Id'])['task']['Statement'].replace( '<br/>', ''), 'time': int( time.mktime( time.strptime(task['TimeCreated'], '%Y-%m-%d %H:%M:%S'))), 'project': self.settings['name'], 'comments': [], } comments = c.get_task_comments(task['Id']) if 'comments' in comments: for comment in comments['comments'].values(): issue['comments'].append({ 'time': comment['TimeCreated'], 'user': comment['Author']['Name'], 'body': comment['Text'].replace('<br/>', ''), }) issues[task['Id']] = issue return issues