def get_app_maintainers(username, bk_biz_id, bk_supplier_account=None): """获取业务下的所有运维 """ resp = cmdb.get_application_with_page( username, bk_supplier_account=bk_supplier_account, fields=['bk_biz_maintainer'], condition={'bk_biz_id': bk_biz_id}) if resp.get('code') != ErrorCode.NoError: return [] biz_info = (resp.get('data') or {}).get('info') or [] if not biz_info: return [] maintainers = biz_info[0].get('bk_biz_maintainer') or '' return re.findall(r'[^,;]+', maintainers)
def get_application_staff(username, bk_biz_id, fields=None): """获取业务的成员列表""" if not fields: fields = [ 'bk_biz_developer', 'bk_biz_maintainer', 'bk_biz_tester', 'bk_biz_productor' ] resp = cmdb.get_application_with_page(username, fields=fields, condition={'bk_biz_id': bk_biz_id}) if resp.get('code') != ErrorCode.NoError: raise error_codes.CheckFailed(_('该项目关联的业务不正确,请确认后重试')) data = resp.get('data') or {} info = data.get('info') or [] if not info: raise error_codes.CheckFailed(_('查询项目信息为空')) return info[0]