Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

dest should do the trick, so that sockpath will be stored in socketpath #216

Merged
merged 6 commits into from Sep 26, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Expand Up @@ -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

Expand Down
1 change: 1 addition & 0 deletions gvmtools/parser.py
Expand Up @@ -259,6 +259,7 @@ def _add_subparsers(self):
'--sockpath',
nargs='?',
default=None,
dest='socketpath',
help='Deprecated, use --socketpath instead',
)
socketpath_group.add_argument(
Expand Down
7 changes: 0 additions & 7 deletions gvmtools/pyshell.py
Expand Up @@ -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()
Expand Down
8 changes: 0 additions & 8 deletions gvmtools/script.py
Expand Up @@ -17,7 +17,6 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.

import os
import sys

from argparse import Namespace

Expand Down Expand Up @@ -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()
Expand Down
4 changes: 2 additions & 2 deletions 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)
5 changes: 2 additions & 3 deletions tests/test_parser.py
Expand Up @@ -171,16 +171,15 @@ 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'])
self.assertEqual(args.connection_type, 'socket')

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'])
Expand Down