diff --git a/agents/bakery/curl.py b/agents/bakery/curl.py index 28169f8d6a882c286314b7dd0f905ef508e40ea9..2f133ca90cd01c6a35f85ac1631b24b4954d2764 100755 --- a/agents/bakery/curl.py +++ b/agents/bakery/curl.py @@ -180,8 +180,8 @@ def get_curl_files(conf) -> FileGenerator: _headers = [] # filter options - _options.append(url_settings['get_header_only']) if url_settings.get('get_header_only') else None - _options.append(url_settings['compressed']) if url_settings.get('compressed') else None + _options.append(f'--head') if url_settings.get('get_header_only') else None + _options.append(f'--compressed') if url_settings.get('compressed') else None _options.append(f'--max-time {url_settings["max_time"]}') if url_settings.get('max_time') else None _options.append(f'--speed-time {url_settings["speed_time"]}') if url_settings.get('speed_time') else None _options.append(f'--connect-timeout {url_settings["connect_timeout"]}') if url_settings.get('connect_timeout') else None diff --git a/curl.mkp b/curl.mkp index c6feb860a25fcd019e4f88f5cb52c76ce6417b68..af7f3d6dcdcc8567dc2d310f9a8e71b707d1c7f8 100644 Binary files a/curl.mkp and b/curl.mkp differ diff --git a/packages/curl b/packages/curl index a769adf20929392d244c5d113a80e658b226256c..fee221aa2f8b180d129a0d90a3139932a3a5c7f4 100644 --- a/packages/curl +++ b/packages/curl @@ -26,7 +26,7 @@ 'name': 'curl', 'num_files': 6, 'title': 'cURL agent plugin', - 'version': '20220410.v0.1.7', + 'version': '20220411.v0.1.7', 'version.min_required': '2.0.0', 'version.packaged': '2021.09.20', 'version.usable_until': None} \ No newline at end of file diff --git a/web/plugins/wato/curl.py b/web/plugins/wato/curl.py index 56adc424c780a26f1e1ef5b99a190b58642bd73a..36b89c142afafaf0a262f76b7887734a1be193fd 100644 --- a/web/plugins/wato/curl.py +++ b/web/plugins/wato/curl.py @@ -69,32 +69,33 @@ # windows/linux summarized under on option, no separate WATO rules per OS necessary anymore # replaced most CascadingDropdown with Alternative to avoid the need for adusting default and url settings # in the bakery +# 2020-04-11: fixed user-agent per url (changed from CascadingDropdown to Alternative) # import ipaddress from cmk.gui.i18n import _ from cmk.gui.exceptions import MKUserError from cmk.gui.valuespec import ( - Dictionary, - ListOf, + Age, + Alternative, + CAorCAChain, CascadingDropdown, - TextUnicode, + Checkbox, + Dictionary, + DropdownChoice, FixedValue, + Foldable, Integer, - Tuple, - DropdownChoice, - MonitoringState, + ListOf, ListOfStrings, + MonitoringState, + Optional, TextInput, - Checkbox, + TextUnicode, Transform, - CAorCAChain, - Optional, - Foldable, - Age, - # Url, + Tuple, UploadOrPasteTextFile, - Alternative, + # Url, ) from cmk.gui.plugins.wato import ( rulespec_registry, @@ -391,7 +392,8 @@ _option_regex_response = ('regex_response', elements=[ TextUnicode( label=_('Regular expression'), - placeholder=_('If empty regex search will be disabled') + placeholder=_('If empty regex search will be disabled'), + size=70, ), Checkbox('Case insensitive'), Checkbox('Multiline string matching'), @@ -417,17 +419,17 @@ _option_advanced_settings = ('advanced_settings', _options_get_header_only = ('get_header_only', FixedValue( - '--head', + True, + # help=_('cURL will will only download headers. Implements the "--head" option'), title=_('Get header only'), - totext=_('Only headers will be downloaded'), - help=_('cURL will will only download headers. Implements the "--head" option'), + totext=_(''), )) _url_get_header_only = ('get_header_only', - DropdownChoice( + Alternative( title=_('Get Header only'), - choices=[ - ('--head', _('Get header only')), - ('', _('Get the hole document')), + elements=[ + _options_get_header_only[1], + FixedValue(None, title=_('Get the hole document'), totext=_('')), ], )) @@ -478,8 +480,12 @@ _option_auth_priv_key = ('priv_key_auth', title=_('Pass phrase'), allow_empty=False, ), - Foldable(UploadOrPasteTextFile(title='Private key', file_title='Private key (PEM)'), - title='Private key'), + Foldable( + UploadOrPasteTextFile( + title='Private key', + file_title='Private key (PEM)' + ), + title='Private key'), ] )) _option_auth = ('user_auth', @@ -524,7 +530,6 @@ _option_proxy_server = ('proxy_server', ], orientation='horizontal', )) - _option_proxy_auth = ('proxy_auth', Tuple( title=_('Proxy authentication'), @@ -556,7 +561,6 @@ _option_proxy_auth = ('proxy_auth', ]), ], )) - _options_proxy = ('http_proxy', Alternative( title=_('Configure proxy server'), @@ -876,7 +880,7 @@ _option_api_key_header = ('api_key_header', )) _url_api_key_header = ('api_key_header', Alternative( - title=_('Set API key header'), + title=_('Override API key header'), elements=[ _option_api_key_header[1], FixedValue(None, title=_('Don\'t configure an API key header'), totext=_('')), @@ -1059,13 +1063,11 @@ _option_user_agent = ('user_agent', forbidden_chars='"|' )) _url_user_agent = ('user_agent', - CascadingDropdown( - title=_('Set user agent'), - sorted=False, - choices=[ - ('user_agent', _('Override default user agent'), - _option_user_agent[1],), - ('', _('Don\'t configure a user agent')), + Alternative( + title=_('Override user agent'), + elements=[ + _option_user_agent[1], + FixedValue(None, title=_('Don\'t configure a user agent'), totext=_('')), ], )) @@ -1088,20 +1090,20 @@ _url_referer = ('referer', _options_compressed = ('compressed', FixedValue( - '--compressed', + True, title=_('Request compressed response'), - totext=_('Request compressed response enabled'), + totext=_(''), )) _url_compressed = ('compressed', - DropdownChoice( + Alternative( title=_('Request compressed response'), - choices=[ - ('--compressed', _('Request compressed response')), - ('', _('Don\'t Request compressed response')), + elements=[ + _options_compressed[1], + FixedValue(None, title=_('Don\'t Request compressed response'), totext=_('')), ], )) -_option_post = ('post_binary', +_options_post = ('post_binary', Tuple( title=_('Send HTTP POST data'), elements=[ @@ -1121,6 +1123,14 @@ _option_post = ('post_binary', ), ] )) +_url_post = ('post_binary', + Alternative( + title=_('Override send HTTP POST data'), + elements=[ + _options_post[1], + FixedValue(None, title='Don\'t send HTTP POST data', totext=_('')), + ] + )) _option_url_settings = ('url_settings', Foldable( @@ -1134,7 +1144,7 @@ _option_url_settings = ('url_settings', _url_get_header_only, _option_regex_response, _url_compressed, - _option_post, + _url_post, _url_api_key_header, _url_referer, _url_request_headers, @@ -1217,7 +1227,7 @@ _option_default_settings = ('default_settings', _options_get_header_only, _option_regex_response, _options_compressed, - _option_post, + _options_post, _option_api_key_header, _option_referer, _option_request_headers,