Commit 431b7de0 by Your Name

Agent update fix

parent 848ff728
......@@ -532,7 +532,6 @@ LOGIN_REDIRECT_URL = "/"
AGENT_DIR = get_env_variable(
'DJANGO_AGENT_DIR', join(unicode(expanduser("~")), 'agent'))
# AGENT_DIR is the root directory for the agent.
# The directory structure SHOULD be:
# /home/username/agent
......@@ -544,12 +543,13 @@ AGENT_DIR = get_env_variable(
#
try:
git_env = {'GIT_DIR': join(join(AGENT_DIR, "agent-linux"), '.git')}
git_env = {'GIT_DIR': join(join(AGENT_DIR, "agent"), ".git")}
AGENT_VERSION = check_output(
('git', 'log', '-1', r'--pretty=format:%h', 'HEAD'), env=git_env)
except:
AGENT_VERSION = Non = (join(SITE_ROOT, 'locale'), )
print("LEGACY VERSION: %s ------" % AGENT_VERSION)
#### NEW ####
####
......@@ -563,8 +563,8 @@ except:
try:
with open("%s/versions.txt" % AGENT_DIR, "r") as f:
AGENT_VERSIONS = loads(f.read())
print("-----KONWN VERSIONS-----")
print(AGENT_VERSIONS)
print("-----KONWN VERSIONS-----")
print(AGENT_VERSIONS)
except:
print("Format ERROR in versions.txt !!!! ") # TODO more error reposrting
AGENT_VERSIONS = None
......
......@@ -1588,7 +1588,8 @@ class AgentStartedOperation(InstanceOperation):
self.instance._set_hostname(parent_activity=activity)
new_version = settings.GET_AGENT_VERSION_BY_SYSTEM(agent_system)[0]
if agent_system and new_version and (old_version is None or old_version and new_version != old_version):
# if agent_system and new_version and (old_version is None or ("NOAGENTUPDATE" not in old_version and new_version != old_version)) :
if agent_system and new_version and old_version and "NOAGENTUPDATE" not in old_version and new_version != old_version :
try:
self.instance.update_agent(
parent_activity=activity, agent_system=agent_system)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment