Skip to content
This repository was archived by the owner on Oct 7, 2021. It is now read-only.
This repository was archived by the owner on Oct 7, 2021. It is now read-only.

agent crashes if directory from agent.cfg OptDir doesn't exist #150

@namachieli

Description

@namachieli

Ran into an issue when running an agent for the first time, where the agent didn't run and compile everything itself. (I put an already compiled copy of todd and todd-agent into /usr/bin and manually made /etc/todd/agent.cfg)

When starting the agent I got

FATA[0000] "unable to open database file": 
                CREATE TABLE testruns (id INTEGER NOT NULL PRIMARY KEY, uuid TEXT, testlet TEXT, args TEXT, targets TEXT, results TEXT);
                CREATE TABLE keyvalue (id INTEGER NOT NULL PRIMARY KEY, key TEXT, value TEXT);

Looking into it, it seems that if the directory /opt/todd/agent/ doesn't exist, the agent dies when attempting to make /opt/todd/agent/agent_cache.db. If i make the directory manually, todd-agent then creates required sub-directories, creates the db file, and downloads both factcollector scripts.

toddagent@agent:~$ sudo mkdir -p /opt/todd/agent
toddagent@agent:~$ sudo todd-agent           
DEBU[0000] Writing keyvalue pair to agent cache - uuid:b6fe98b2411ce24e206682d3184fc3ad0da30278254660f1e471a4c81287ef54
 
INFO[0000] ToDD Agent Activated: b6fe98b2411ce24e206682d3184fc3ad0da30278254660f1e471a4c81287ef54 
DEBU[0000] Retrieving value of key - uuid
              
DEBU[0000] Retrieving value of key - group
             
DEBU[0000] Agent re-registering onto group queue - null 
INFO[0000] AGENTADV -- 2017-05-01 17:08:07.823829677 +0000 UTC 
INFO[0000]  [*] Waiting for messages. To exit press CTRL+C 
DEBU[0000] Agent task received: {"type":"DownloadAsset","assets":["http://10.17.9.159:8090/factcollectors/get_addresses","http://10.17.9.159:8090/factcollectors/get_hostname","http://10.17.9.159:8090/testlets/iperf","http://10.17.9.159:8090/testlets/http"]} 
INFO[0000] Downloading http://10.17.9.159:8090/factcollectors/get_addresses to /opt/todd/agent/assets/factcollectors/get_addresses 
INFO[0000] 425 bytes downloaded.                        
INFO[0000] Downloading http://10.17.9.159:8090/factcollectors/get_hostname to /opt/todd/agent/assets/factcollectors/get_hostname 
INFO[0000] 231 bytes downloaded.    
                    
toddagent@agent:~$ ls -LR /opt/todd/agent
/opt/todd/agent:
agent_cache.db  assets

/opt/todd/agent/assets:
factcollectors  testlets

/opt/todd/agent/assets/factcollectors:
get_addresses  get_hostname

/opt/todd/agent/assets/testlets:
http  iperf

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions