Commit 431b7de0 by Your Name

Agent update fix

parent 848ff728
...@@ -532,7 +532,6 @@ LOGIN_REDIRECT_URL = "/" ...@@ -532,7 +532,6 @@ LOGIN_REDIRECT_URL = "/"
AGENT_DIR = get_env_variable( AGENT_DIR = get_env_variable(
'DJANGO_AGENT_DIR', join(unicode(expanduser("~")), 'agent')) 'DJANGO_AGENT_DIR', join(unicode(expanduser("~")), 'agent'))
# AGENT_DIR is the root directory for the agent. # AGENT_DIR is the root directory for the agent.
# The directory structure SHOULD be: # The directory structure SHOULD be:
# /home/username/agent # /home/username/agent
...@@ -544,12 +543,13 @@ AGENT_DIR = get_env_variable( ...@@ -544,12 +543,13 @@ AGENT_DIR = get_env_variable(
# #
try: 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( AGENT_VERSION = check_output(
('git', 'log', '-1', r'--pretty=format:%h', 'HEAD'), env=git_env) ('git', 'log', '-1', r'--pretty=format:%h', 'HEAD'), env=git_env)
except: except:
AGENT_VERSION = Non = (join(SITE_ROOT, 'locale'), ) AGENT_VERSION = Non = (join(SITE_ROOT, 'locale'), )
print("LEGACY VERSION: %s ------" % AGENT_VERSION)
#### NEW #### #### NEW ####
#### ####
...@@ -563,8 +563,8 @@ except: ...@@ -563,8 +563,8 @@ except:
try: try:
with open("%s/versions.txt" % AGENT_DIR, "r") as f: with open("%s/versions.txt" % AGENT_DIR, "r") as f:
AGENT_VERSIONS = loads(f.read()) AGENT_VERSIONS = loads(f.read())
print("-----KONWN VERSIONS-----") print("-----KONWN VERSIONS-----")
print(AGENT_VERSIONS) print(AGENT_VERSIONS)
except: except:
print("Format ERROR in versions.txt !!!! ") # TODO more error reposrting print("Format ERROR in versions.txt !!!! ") # TODO more error reposrting
AGENT_VERSIONS = None AGENT_VERSIONS = None
......
...@@ -1588,7 +1588,8 @@ class AgentStartedOperation(InstanceOperation): ...@@ -1588,7 +1588,8 @@ class AgentStartedOperation(InstanceOperation):
self.instance._set_hostname(parent_activity=activity) self.instance._set_hostname(parent_activity=activity)
new_version = settings.GET_AGENT_VERSION_BY_SYSTEM(agent_system)[0] 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: try:
self.instance.update_agent( self.instance.update_agent(
parent_activity=activity, agent_system=agent_system) 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