Retrieve the contents of a script

    Retrieve the contents of a script # noqa: E501

    :param name2: Get status of a driver with this name
    :type name2: str
    :param name: The script name.
    :type name: str

    :rtype: Response
430856
def get_driver_script(name, name2=None):  # noqa: E501
    
    response = errorIfUnauthorized(role='user')
    if response:
        return response
    else:
        response = ApitaxResponse()

    print(name)
    print(name2)


    driver: Driver = LoadedDrivers.getDriver(name2)

    response.body.add({'content': driver.getDriverScript(name)})

    return Response(status=200, body=response.getResponseBody())
595235
def get(self, name=None):
        
        if name is None:
            return self._plugins
        else:
            if name not in self._plugins.keys():
                return None
            else:
                return self._plugins[name]
538187
def get_driver_script_catalog(name):  # noqa: E501
    

    response = errorIfUnauthorized(role='user')
    if response:
        return response
    else:
        response = ApitaxResponse()

    driver: Driver = LoadedDrivers.getDriver(name)

    response.body.add(driver.getDriverScriptCatalog().get())

    return Response(status=200, body=response.getResponseBody())
1071234
def driver_status(name):  # noqa: E501
    
    if(not hasAccess()):
        return redirectUnauthorized()

    driver = LoadedDrivers.getDefaultDriver()
    body = {"name": str(driver.__class__.__name__)}
    body.update(driver.serialize())
    return Response(status=200, body=body)
1097624
def get_provider_name(driver):
    
    kls = driver.__class__.__name__
    for d, prop in DRIVERS.items():
        if prop[1] == kls:
            return d
    return None
577006
private Object getScriptResult(String script, ScriptEngine engine) throws ScriptException {
        String scriptToExecute = script.substring(script.indexOf(":") + 1);
        return engine.eval(scriptToExecute);
    }
85775
def driver_name(self):
        
        (self._driver_name, value) = self.get_cached_attr_string(self._driver_name, 'driver_name')
        return value
1156756
def get_driver_api_catalog(driver):  # noqa: E501
    
    response = errorIfUnauthorized(role='developer')
    if response:
        return response
    else:
        response = ApitaxResponse()

    driver: Driver = LoadedDrivers.getDriver(driver)
    response.body.add(driver.getApiEndpointCatalog())

    return Response(status=200, body=response.getResponseBody())
352686
def _load_script(self):
        
        script_text = filesystem.read_file(self.path, self.filename)

        if not script_text:
            raise IOError("Script file could not be opened or was empty: {0}"
                          "".format(os.path.join(self.path, self.filename)))
        self.script = script_text
178059
def _get_client_fqdn(self, client_info_contents):
    
    yamldict = yaml.safe_load(client_info_contents)
    fqdn = yamldict['system_info']['fqdn']
    client_id = yamldict['client_id'].split('/')[1]
    return client_id, fqdn
1343237
def _find_script(script_name):
    
    if os.path.isfile(script_name):
        return script_name
    path = os.getenv('PATH', os.defpath).split(os.pathsep)
    for folder in path:
        if not folder:
            continue
        fn = os.path.join(folder, script_name)
        if os.path.isfile(fn):
            return fn

    sys.stderr.write('Could not find script {0}\n'.format(script_name))
    raise SystemExit(1)
1231188
def create_driver_script(name, create=None):  # noqa: E501
    
    if connexion.request.is_json:
        create = Create1.from_dict(connexion.request.get_json())  # noqa: E501

    response = errorIfUnauthorized(role='developer')
    if response:
        return response
    else:
        response = ApitaxResponse()

    driver: Driver = LoadedDrivers.getDriver(name)
    driver.saveDriverScript(create.script.name, create.script.content)

    return Response(status=200, body=response.getResponseBody())
325266
def _get_script(self):
        
        if settings.repeat:
            repeat_fuck = '{} --repeat {}--force-command {}'.format(
                get_alias(),
                '--debug ' if settings.debug else '',
                shell.quote(self.script))
            return shell.or_(self.script, repeat_fuck)
        else:
            return self.script
1103817
def save_script(save=None):  # noqa: E501
    
    if connexion.request.is_json:
        save = Save.from_dict(connexion.request.get_json())  # noqa: E501

    if(not hasAccess()):
        return redirectUnauthorized()

    driver = LoadedDrivers.getDefaultDriver()
    driver.saveScript(save.script.name, save.script.content)
    return Response(status=200, body={'file-name': save.script.name})
818138
def fetch_library(name)
      library_script = @server_registry['library', name]
      
      logger.debug {"#{logname}: Tried to fetch script '#{name}' from the registry and it " +
                    "was #{'not ' if library_script.nil?}found."}

      raise NameError, "Server cannot find a script named #{name}" if library_script.nil?

      library_script
    end
1234548
def rename_script(rename=None):  # noqa: E501
    
    if connexion.request.is_json:
        rename = Rename.from_dict(connexion.request.get_json())  # noqa: E501

    if(not hasAccess()):
        return redirectUnauthorized()

    driver = LoadedDrivers.getDefaultDriver()
    if (not driver.renameScript(rename.original.name, rename.new.name)):
        return ErrorResponse(status=500, message='Cannot rename to an existing file.')
    return Response(status=200, body={'file-name': rename.new.name})
999653
def save_driver_script(driver, script_save=None):  # noqa: E501
    
    if connexion.request.is_json:
        script_save = ScriptSave.from_dict(connexion.request.get_json())  # noqa: E501

    response = errorIfUnauthorized(role='developer')
    if response:
        return response
    else:
        response = ApitaxResponse()

    driver: Driver = LoadedDrivers.getDriver(driver)
    driver.saveDriverScript(script_save.script.name, script_save.script.content)

    return Response(status=200, body=response.getResponseBody())