Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
home:Ledest:erlang:24
erlang
7162-snmp-Types-and-specs-for-snmp-start_agent-...
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File 7162-snmp-Types-and-specs-for-snmp-start_agent-0-1.patch of Package erlang
From dffc188d496ca842c077b0c3ccdd9db3d920faa1 Mon Sep 17 00:00:00 2001 From: Micael Karlberg <bmk@erlang.org> Date: Thu, 11 Jan 2024 08:25:20 +0100 Subject: [PATCH 22/67] [snmp] Types and specs for snmp:start_agent/0,1 --- lib/snmp/doc/src/snmp.xml | 28 +++++++++++++--------------- lib/snmp/src/app/snmp.erl | 6 ++++++ lib/snmp/src/app/snmp_app.erl | 12 +++++------- 3 files changed, 24 insertions(+), 22 deletions(-) diff --git a/lib/snmp/doc/src/snmp.xml b/lib/snmp/doc/src/snmp.xml index 8e72087521..9790f85252 100644 --- a/lib/snmp/doc/src/snmp.xml +++ b/lib/snmp/doc/src/snmp.xml @@ -216,24 +216,22 @@ </func> <func> - <name since="">start_agent() -> ok | {error, Reason}</name> - <name since="">start_agent(Type) -> ok | {error, Reason}</name> + <name name="start_agent" arity="0" clause_i="1" since=""/> + <name name="start_agent" arity="1" clause_i="1" since=""/> <fsummary>Start the agent part of the SNMP application</fsummary> - <type> - <v>Type = start_type()</v> - </type> <desc> <p>The SNMP application consists of several entities, of which the - agent is one. This function starts the agent entity of the - application. - </p> - <p>Note that the only way to actually start the agent in this way is - to add the agent related config after starting the application (e.g - it cannot be part of the normal application config; sys.config). - This is done by calling: - <c>application:set_env(snmp, agent, Conf)</c>. - </p> - <p>The default value for <c>Type</c> is <c>normal</c>.</p> + agent is one. This function starts the agent entity of the + application. </p> + + <p>Note that the only way to actually start the agent in this way is + to add the agent related config after starting the application (e.g + it cannot be part of the normal application config; sys.config). + This is done by calling: + <c><![CDATA[application:set_env(snmp, agent, Conf)]]></c>. </p> + + <p>The default value for <c><![CDATA[Type]]></c> is + <c><![CDATA[normal]]></c>. </p> <marker id="start_manager"></marker> </desc> diff --git a/lib/snmp/src/app/snmp.erl b/lib/snmp/src/app/snmp.erl index bf3b43a3c0..954e1bb784 100644 --- a/lib/snmp/src/app/snmp.erl +++ b/lib/snmp/src/app/snmp.erl @@ -234,10 +234,16 @@ stop() -> application:stop(?APPLICATION). +-spec start_agent() -> ok | {error, Reason} when + Reason :: term(). start_agent() -> snmp_app:start_agent(). +-spec start_agent(Type) -> ok | {error, Reason} when + Type :: application:start_type(), + Reason :: term(). + start_agent(Type) -> snmp_app:start_agent(Type). diff --git a/lib/snmp/src/app/snmp_app.erl b/lib/snmp/src/app/snmp_app.erl index 7ba3c659f0..6c1c1aeefe 100644 --- a/lib/snmp/src/app/snmp_app.erl +++ b/lib/snmp/src/app/snmp_app.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2003-2023. All Rights Reserved. +%% Copyright Ericsson AB 2003-2024. All Rights Reserved. %% %% Licensed under the Apache License, Version 2.0 (the "License"); %% you may not use this file except in compliance with the License. @@ -105,17 +105,15 @@ start_entities(Type, [BadEntity|Entities]) -> start_agent() -> start_agent(normal). -start_agent(Type) when is_atom(Type) -> +start_agent(Opts) when is_list(Opts) -> + start_agent(normal, Opts); +start_agent(Type) -> case application:get_env(snmp, agent) of {ok, Opts} -> start_agent(Type, Opts); _ -> {error, missing_config} - end; -start_agent(Opts) when is_list(Opts) -> - start_agent(normal, Opts); -start_agent(BadArg) -> - {error, {bad_arg, BadArg}}. + end. start_agent(Type, Opts) -> ?d("start_agent -> entry", []), -- 2.35.3
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor