Commit 2614eae06f1c08caac1245806ca83a99654979d2
1 parent
4fac45d0
Exists in
dev
bugfix AgentBasic
Showing
2 changed files
with
21 additions
and
5 deletions
Show diff stats
src/core/pyros_django/majordome/agent/AgentBasic.py renamed to src/core/pyros_django/majordome/agent/A_Basic.py
@@ -3,15 +3,31 @@ | @@ -3,15 +3,31 @@ | ||
3 | 3 | ||
4 | import time | 4 | import time |
5 | import sys, argparse | 5 | import sys, argparse |
6 | +import os | ||
6 | 7 | ||
7 | ##import utils.Logger as L | 8 | ##import utils.Logger as L |
8 | 9 | ||
9 | ##from .Agent import Agent | 10 | ##from .Agent import Agent |
10 | ##sys.path.append("..") | 11 | ##sys.path.append("..") |
11 | ###from agent.Agent import Agent, build_agent | 12 | ###from agent.Agent import Agent, build_agent |
12 | -sys.path.append("../../../..") | 13 | + |
14 | +###sys.path.append("../../../..") | ||
15 | + | ||
16 | +pwd = os.environ['PROJECT_ROOT_PATH'] | ||
17 | +if pwd not in sys.path: | ||
18 | + sys.path.append(pwd) | ||
19 | + | ||
20 | +short_paths = ['src', 'src/core/pyros_django'] | ||
21 | +for short_path in short_paths: | ||
22 | + path = os.path.join(pwd, short_path) | ||
23 | + if path not in sys.path: | ||
24 | + sys.path.insert(0, path) | ||
25 | + | ||
26 | + | ||
13 | #from src.core.pyros_django.common.models import AgentCmd | 27 | #from src.core.pyros_django.common.models import AgentCmd |
14 | -from src.core.pyros_django.majordome.agent.Agent import Agent, build_agent | 28 | +#from src.core.pyros_django.majordome.agent.Agent import Agent, build_agent |
29 | +from majordome.agent.Agent import Agent, build_agent | ||
30 | + | ||
15 | #from src.core.pyros_django.common.models import AgentCmd | 31 | #from src.core.pyros_django.common.models import AgentCmd |
16 | 32 | ||
17 | from typing import List, Tuple, Union, Any | 33 | from typing import List, Tuple, Union, Any |
@@ -20,7 +36,7 @@ from typing import List, Tuple, Union, Any | @@ -20,7 +36,7 @@ from typing import List, Tuple, Union, Any | ||
20 | 36 | ||
21 | 37 | ||
22 | 38 | ||
23 | -class AgentBasic(Agent): | 39 | +class A_Basic(Agent): |
24 | 40 | ||
25 | # FOR TEST ONLY | 41 | # FOR TEST ONLY |
26 | # Run this agent in simulator mode | 42 | # Run this agent in simulator mode |
@@ -459,7 +475,7 @@ if __name__ == "__main__": | @@ -459,7 +475,7 @@ if __name__ == "__main__": | ||
459 | parser.add_argument("--computer",dest="computer",help='Launch agent with simulated computer hostname',action="store") | 475 | parser.add_argument("--computer",dest="computer",help='Launch agent with simulated computer hostname',action="store") |
460 | parser.add_argument("-t", action="store_true") | 476 | parser.add_argument("-t", action="store_true") |
461 | args = vars(parser.parse_args()) | 477 | args = vars(parser.parse_args()) |
462 | - agent = build_agent(AgentBasic,param_constr=args) | 478 | + agent = build_agent(A_Basic, param_constr=args) |
463 | 479 | ||
464 | ''' | 480 | ''' |
465 | TEST_MODE, configfile = extract_parameters() | 481 | TEST_MODE, configfile = extract_parameters() |
src/core/pyros_django/scp_mgmt/A_SCP_Manager.py
@@ -313,7 +313,7 @@ if __name__ == "__main__": | @@ -313,7 +313,7 @@ if __name__ == "__main__": | ||
313 | print("ARGV OF AGENT SP :",sys.argv) | 313 | print("ARGV OF AGENT SP :",sys.argv) |
314 | if len(sys.argv) > 1 and sys.argv[1] == "test": | 314 | if len(sys.argv) > 1 and sys.argv[1] == "test": |
315 | print("i'm in test") | 315 | print("i'm in test") |
316 | - agentSP = AgentSP(use_db_test=True) | 316 | + agentSP = A_SCP_Manager(use_db_test=True) |
317 | agentSP.run() | 317 | agentSP.run() |
318 | #agent = build_agent(agentSP, RUN_IN_THREAD=True) | 318 | #agent = build_agent(agentSP, RUN_IN_THREAD=True) |
319 | else: | 319 | else: |