@@ -81,6 +81,47 @@ def _migrate_int_to_float(value: object) -> Mapping[str, object]:
8181 }
8282
8383
84+ def _migrate_int_to_float2 (value : object ) -> Mapping [str , object ]:
85+ """
86+ migrate from integer interval to float interval
87+ """
88+ if value is not None :
89+ # backward compatibility - migrate from deploy to deployment
90+ if value .get ('deploy' ):
91+ if value ['deploy' ].get ('interval' ):
92+ return {
93+ 'deploy' : {
94+ 'interval' : float (value ['deploy' ]['interval' ])
95+ }
96+ }
97+ else :
98+ return {
99+ 'deploy' : {
100+ 'interval' : False
101+ }
102+ }
103+ # fix a short time used interval instead of deploy
104+ elif value .get ('interval' ):
105+ return {
106+ 'deploy' : {
107+ 'interval' : float (value ['interval' ])
108+ }
109+ }
110+ # backward compatibility
111+ elif value .get ('nointerval' ):
112+ return {
113+ 'deploy' : {
114+ 'interval' : False
115+ }
116+ }
117+ else :
118+ return value
119+ else :
120+ return {
121+ 'deploy' : False
122+ }
123+
124+
84125def _parameter_form_yum_bakery () -> Dictionary :
85126 """
86127 definition of the parameter form for the YUM bakery plugin
@@ -138,10 +179,48 @@ def _parameter_form_yum_bakery() -> Dictionary:
138179 )
139180
140181
182+ def _parameter_form_yum_bakery2 () -> Dictionary :
183+ """
184+ definition of the parameter form for the YUM bakery plugin
185+ :return:
186+ """
187+ return Dictionary (
188+ migrate = _migrate_int_to_float2 ,
189+ title = Title ('YUM Update Check' ),
190+ help_text = Help ('This will deploy the agent plugin <tt>YUM</tt>. This will activate the '
191+ 'check <tt>YUM</tt> on RedHat based hosts and monitor pending normal and security updates.'
192+ ),
193+ elements = {
194+ 'deploy' : DictElement (
195+ parameter_form = Dictionary (
196+ title = Title ('Deploy plugin' ),
197+ help_text = Help (
198+ 'Determines how the the <tt>YUM</tt> plugin will run on a deployed agent or disables it on an deployed agent' ),
199+ elements = {
200+ 'interval' : DictElement (
201+ parameter_form = TimeSpan (
202+ title = Title ('Run asynchronously' ),
203+ label = Label ('Interval for collecting data' ),
204+ help_text = Help (
205+ 'Determines how often the plugin will run on a deployed agent.' ),
206+ displayed_magnitudes = [TimeMagnitude .SECOND ,
207+ TimeMagnitude .MINUTE ,
208+ TimeMagnitude .HOUR ,
209+ TimeMagnitude .DAY ],
210+ prefill = DefaultValue (DEFAULT_INTERVAL ),
211+ )
212+ )
213+ }
214+ ),
215+ )
216+ }
217+ )
218+
219+
141220rule_spec_yum_bakery = AgentConfig (
142221 title = Title ('YUM Update Check' ),
143222 name = 'yum' ,
144- parameter_form = _parameter_form_yum_bakery ,
223+ parameter_form = _parameter_form_yum_bakery2 ,
145224 topic = Topic .OPERATING_SYSTEM ,
146225 help_text = Help ('This will deploy the agent plugin <tt>YUM</tt> '
147226 'for checking package update status.' ),
0 commit comments