opengear / opengear.om

Ansible Network Collection for Opengear OM
GNU General Public License v3.0
5 stars 7 forks source link

Remove hardcoded path to structure.json #10

Closed Disco402 closed 5 months ago

Disco402 commented 5 months ago

Hardcoded path to structure.json breaks running this on other machines. Probably a much better way to do this but seem to work locally

To fix issue https://github.com/opengear/opengear.om/issues/3 and https://github.com/opengear/opengear.om/issues/9

Disco402 commented 5 months ago

@mattwit

Im not sure this has fixed it - Certain modules still fail with missing directory, only work around ive found so far is to put the contents of structure.json into a variable in utils.py and return it directly e.g.

structure = """{
  "system": {
    "hostname": ["system_hostname", "hostname"],
    "banner": ["system_banner", "banner"],
    "webui_session_timeout": ["system_webui_session_timeout", "timeout"],
    "cli_session_timeout": ["system_cli_session_timeout", "timeout"],
    "system_authorized_keys": ["system_authorized_keys"],
    "ssh_port": ["system_ssh_port", "port"],
    "timezone": ["system_timezone", "timezone"],
    "time": ["time", "time"],
    "admin_info": ["system_admin_info"]
  }
}"""

def get_restapi_body_structure():
    return json.loads(structure)