Skip to content

Commit

Permalink
Merge branch 'master' into ops-agent-fix
Browse files Browse the repository at this point in the history
  • Loading branch information
iguannalin committed Nov 9, 2021
2 parents f0d16ae + 0ba7e82 commit 8a9f149
Show file tree
Hide file tree
Showing 3 changed files with 133 additions and 38 deletions.
22 changes: 18 additions & 4 deletions app/api/v2/handlers/config_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,15 @@ def add_routes(self, app: web.Application):
router.add_patch('/config/main', self.update_main_config)
router.add_patch('/config/agents', self.update_agents_config)

@aiohttp_apispec.docs(tags=['config'])
@aiohttp_apispec.docs(tags=['config'], summary='Retrieve Config',
parameters=[{
'in': 'path',
'name': 'name',
'schema': {'type': 'string'},
'required': 'true',
'description': 'Name of the configuration file to be retrieved.'
}],
description='Retrieves configuration by name, as specified by {name} in the request url.')
async def get_config_with_name(self, request):
config_name = request.match_info['name']

Expand All @@ -28,9 +36,13 @@ async def get_config_with_name(self, request):
raise JsonHttpNotFound(f'Config not found: {config_name}')
return web.json_response(config)

@aiohttp_apispec.docs(tags=['config'])
@aiohttp_apispec.docs(tags=['config'], summary='Update Agent Config',
description='Use fields from the AgentConfigUpdateSchema in the request body to '
'update the Agent Configuration file.')
@aiohttp_apispec.request_schema(AgentConfigUpdateSchema)
@aiohttp_apispec.response_schema(AgentConfigUpdateSchema)
@aiohttp_apispec.response_schema(AgentConfigUpdateSchema,
description='The response consists of data from the Agent configuration file '
'dumped in the AgentConfigUpdateSchema format.')
async def update_agents_config(self, request):
schema = AgentConfigUpdateSchema()
data = await self.parse_json_body(request, schema)
Expand All @@ -39,7 +51,9 @@ async def update_agents_config(self, request):
agents_config = self._api_manager.get_filtered_config('agents')
return web.json_response(schema.dump(agents_config))

@aiohttp_apispec.docs(tags=['config'])
@aiohttp_apispec.docs(tags=['config'], summary='Update Main Config',
description='Use fields from the ConfigUpdateSchema in the request body to '
'update the main configuration file.')
@aiohttp_apispec.request_schema(ConfigUpdateSchema)
async def update_main_config(self, request):
data = await self.parse_json_body(
Expand Down
2 changes: 1 addition & 1 deletion templates/abilities.html
Original file line number Diff line number Diff line change
Expand Up @@ -323,7 +323,7 @@ <h2>Abilities</h2>
<div class="field-body">
<div class="field">
<div class="control has-text-right">
<button class="button is-small is-primary" @click.stop="executor.cleanup.push('')">+ Add Cleanup Command</button>
<button type="button" class="button is-small is-primary" @click.stop="executor.cleanup.push('')">+ Add Cleanup Command</button>
</div>
</div>
</div>
Expand Down
Loading

0 comments on commit 8a9f149

Please sign in to comment.