diff --git a/CHANGELOG.md b/CHANGELOG.md index e2d01dcc..b606dfcf 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -23,6 +23,7 @@ $ cd gvm-tools && git log - Exit with an error, if the `check_gmp.gmp` script is used with an temporary path, that has not the correct permissions. - Fixed `update-task-target.gmp` to create unique target names to support Gmpv8 +- Fixed an error, where the `--sockpath` argument didn't worked as expected [PR 216](https://github.com/greenbone/gvm-tools/pull/216) ### Removed diff --git a/gvmtools/parser.py b/gvmtools/parser.py index f0799355..cab0b533 100644 --- a/gvmtools/parser.py +++ b/gvmtools/parser.py @@ -259,6 +259,7 @@ def _add_subparsers(self): '--sockpath', nargs='?', default=None, + dest='socketpath', help='Deprecated, use --socketpath instead', ) socketpath_group.add_argument( diff --git a/gvmtools/pyshell.py b/gvmtools/pyshell.py index 951f6583..bfa0c7df 100644 --- a/gvmtools/pyshell.py +++ b/gvmtools/pyshell.py @@ -104,13 +104,6 @@ def main(): args = parser.parse_args() - if 'socket' in args.connection_type and args.sockpath: - print( - 'The --sockpath parameter has been deprecated. Please use ' - '--socketpath instead', - file=sys.stderr, - ) - connection = create_connection(**vars(args)) transform = EtreeCheckCommandTransform() diff --git a/gvmtools/script.py b/gvmtools/script.py index 7344026c..fe084b53 100644 --- a/gvmtools/script.py +++ b/gvmtools/script.py @@ -17,7 +17,6 @@ # along with this program. If not, see . import os -import sys from argparse import Namespace @@ -64,13 +63,6 @@ def main(): ) args, script_args = parser.parse_known_args() - if 'socket' in args.connection_type and args.sockpath: - print( - 'The --sockpath parameter has been deprecated. Please use ' - '--socketpath instead', - file=sys.stderr, - ) - connection = create_connection(**vars(args)) transform = EtreeCheckCommandTransform() diff --git a/tests/socket_help.snap b/tests/socket_help.snap index 0bfe11cf..570b7b49 100644 --- a/tests/socket_help.snap +++ b/tests/socket_help.snap @@ -1,9 +1,9 @@ -usage: gvm-test-cli socket [-h] [--sockpath [SOCKPATH] | --socketpath +usage: gvm-test-cli socket [-h] [--sockpath [SOCKETPATH] | --socketpath [SOCKETPATH]] optional arguments: -h, --help show this help message and exit - --sockpath [SOCKPATH] + --sockpath [SOCKETPATH] Deprecated, use --socketpath instead --socketpath [SOCKETPATH] Path to UNIX Domain socket (default: None) diff --git a/tests/test_parser.py b/tests/test_parser.py index 4e38da93..f67d7f77 100644 --- a/tests/test_parser.py +++ b/tests/test_parser.py @@ -171,8 +171,7 @@ def test_with_unknown_args(self): class SocketParserTestCase(ParserTestCase): def test_defaults(self): args = self.parser.parse_args(['socket']) - self.assertIsNone(args.sockpath) - self.assertEqual(args.socketpath, '/usr/local/var/run/gvmd.sock') + self.assertEqual(args.socketpath, DEFAULT_UNIX_SOCKET_PATH) def test_connection_type(self): args = self.parser.parse_args(['socket']) @@ -180,7 +179,7 @@ def test_connection_type(self): def test_sockpath(self): args = self.parser.parse_args(['socket', '--sockpath', 'foo.sock']) - self.assertEqual(args.sockpath, 'foo.sock') + self.assertEqual(args.socketpath, 'foo.sock') def test_socketpath(self): args = self.parser.parse_args(['socket', '--socketpath', 'foo.sock'])