Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: agent register and heartbeat. #1711

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions dongtai_protocol/report/handler/heartbeat_handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ def parse(self):
self.return_queue = self.detail.get("returnQueue", None)

def has_permission(self):
self.agent = IastAgent.objects.filter(id=self.agent_id, user=self.user_id).first()
self.agent = IastAgent.objects.filter(id=self.agent_id).first()
return self.agent

def save_heartbeat(self):
Expand Down Expand Up @@ -174,7 +174,7 @@ def save(self):
self.save_heartbeat()

def get_agent(self, agent_id):
return IastAgent.objects.filter(id=agent_id, user=self.user_id).first()
return IastAgent.objects.filter(id=agent_id).first()


def get_k8s_deployment_id(hostname: str) -> str:
Expand Down
4 changes: 1 addition & 3 deletions dongtai_protocol/report/handler/report_handler_interface.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,11 +100,10 @@ def get_project_agents(self, agent):
agents = IastAgent.objects.filter(
Q(project_name=self.project_name) | Q(bind_project_id=agent.bind_project_id),
online=1,
user=self.user_id,
project_version_id=agent.project_version_id,
)
else:
agents = IastAgent.objects.filter(project_name=agent.project_name, user=self.user_id)
agents = IastAgent.objects.filter(project_name=agent.project_name)
return agents

def get_agent(self, agent_id):
Expand All @@ -113,7 +112,6 @@ def get_agent(self, agent_id):
{
"pk": agent_id,
"online": 1,
"user": self.user_id,
},
(
"id",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -373,7 +373,6 @@ def get_agent(self, agent_id):
{
"pk": agent_id,
"online": 1,
"user": self.user_id,
"allow_report": 1,
},
(
Expand Down
Loading