Beispiel #1
0
    def get(self, section, option):
        """
        Retrieve the value of an option.

        .. :quickref: OptionGetDel; get config value.

        :param section: The section name.
        :resheader Content-Type: application/json
        :status 200: OK.
        :status 401: Invalid Auth Token.
        :status 404: Config not found.
        :status 500: Internal Error.
        """

        try:
            return Response(json.dumps(
                config.get(section=section,
                           option=option,
                           issuer=request.environ.get('issuer'))),
                            content_type="application/json")
        except Exception:
            return generate_http_error_flask(
                404, 'ConfigNotFound',
                'No configuration found for section \'%s\' option \'%s\'' %
                (section, option))
Beispiel #2
0
    def GET(self, section, option):
        """
        Retrieve the value of an option.

        HTTP Success:
            200 OK

        HTTP Error:
            401 Unauthorized
            404 Not Found

        :param Rucio-Auth-Account: Account identifier.
        :param Rucio-Auth-Token: 32 character hex string.
        """

        try:
            return json.dumps(
                config.get(section=section,
                           option=option,
                           issuer=ctx.env.get('issuer')))
        except:
            raise generate_http_error(
                404, 'ConfigNotFound',
                'No configuration found for section \'%s\' option \'%s\'' %
                (section, option))
Beispiel #3
0
    def get(self, section, option):
        """
        Retrieve the value of an option.

        .. :quickref: OptionGetDel; get config value.

        :param section: The section name.
        :resheader Content-Type: application/json
        :status 200: OK.
        :status 401: Invalid Auth Token.
        :status 404: Config not found.
        :status 406: Not Acceptable.
        """
        try:
            result = config.get(section=section,
                                option=option,
                                issuer=request.environ.get('issuer'),
                                vo=request.environ.get('vo'))
            return jsonify(result), 200
        except AccessDenied as error:
            return generate_http_error_flask(
                401, error, f"Access to '{section}' option '{option}' denied")
        except ConfigNotFound as error:
            return generate_http_error_flask(
                404, error,
                f"No configuration found for section '{section}' option '{option}'"
            )
Beispiel #4
0
 def get(self, section, option):
     """
     ---
     summary: Get option
     description: Returns the value of an option
     tags:
       - Config
     parameters:
     - name: section
       in: path
       description: The section.
       schema:
         type: string
       style: simple
     - name: option
       in: path
       description: The option of the section.
       schema:
         type: string
       style: simple
     responses:
       200:
         description: OK
         content:
           application/json:
             schema:
               description: The value of the option
               type: string
       401:
         description: Invalid Auth Token
       404:
         description: Config not found
       406:
         description: Not acceptable
     """
     try:
         result = config.get(section=section,
                             option=option,
                             issuer=request.environ.get('issuer'),
                             vo=request.environ.get('vo'))
         return jsonify(result), 200
     except AccessDenied as error:
         return generate_http_error_flask(
             401, error, f"Access to '{section}' option '{option}' denied")
     except ConfigNotFound as error:
         return generate_http_error_flask(
             404, error,
             f"No configuration found for section '{section}' option '{option}'"
         )
Beispiel #5
0
    def GET(self, section, option):
        """
        Retrieve the value of an option.

        HTTP Success:
            200 OK

        HTTP Error:
            401 Unauthorized
            404 Not Found

        :param Rucio-Auth-Account: Account identifier.
        :param Rucio-Auth-Token: 32 character hex string.
        """

        try:
            return json.dumps(config.get(section=section, option=option, issuer=ctx.env.get('issuer')))
        except:
            raise generate_http_error(404, 'ConfigNotFound', 'No configuration found for section \'%s\' option \'%s\'' % (section, option))