Skip to content
This repository has been archived by the owner on Nov 29, 2021. It is now read-only.

Add lock-file-dir configuration option. #218

Merged
merged 1 commit into from
Mar 5, 2020
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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
- Accept reverse_lookup_only and reverse_lookup_unify target's options. [#195](https://github.com/greenbone/ospd/pull/195)
- Add 'total' and 'sent' attributes to <vts> element for <get_vts> cmd response. [#206](https://github.com/greenbone/ospd/pull/206)
- Add new get_memory_usage command. [#207](https://github.com/greenbone/ospd/pull/207)
- Add lock-file-dir configuration option. [#218](https://github.com/greenbone/ospd/pull/218)

### Changes
- Modify __init__() method and use new syntax for super(). [#186](https://github.com/greenbone/ospd/pull/186)
Expand All @@ -25,6 +26,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
### Fixed
- Fix stop scan. Wait for the scan process to be stopped before delete it from the process table. [#204](https://github.com/greenbone/ospd/pull/204)
- Fix get_scanner_details(). [#210](https://github.com/greenbone/ospd/pull/210)

## [2.0.1] (unreleased)

### Added
Expand Down
8 changes: 6 additions & 2 deletions ospd/parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
DEFAULT_CONFIG_PATH = "~/.config/ospd.conf"
DEFAULT_UNIX_SOCKET_PATH = "/var/run/ospd/ospd.sock"
DEFAULT_PID_PATH = "/var/run/ospd.pid"
DEFAULT_LOCKFILE_DIR_PATH = "/var/run/ospd"
DEFAULT_STREAM_TIMEOUT = 10 # ten seconds
DEFAULT_SCANINFO_STORE_TIME = 0 # in hours

Expand Down Expand Up @@ -87,14 +88,17 @@ def __init__(self, description: str) -> None:
help='Location of the file for the process ID. '
'Default: %(default)s',
)

parser.add_argument(
'--lock-file-dir',
default=DEFAULT_LOCKFILE_DIR_PATH,
help='Directory where lock files are placed. Default: %(default)s',
)
parser.add_argument(
'-m',
'--socket-mode',
default=DEFAULT_UNIX_SOCKET_MODE,
help='Unix file socket mode. Default: %(default)s',
)

parser.add_argument(
'-k',
'--key-file',
Expand Down
10 changes: 9 additions & 1 deletion tests/test_argument_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,10 @@
DEFAULT_KEY_FILE,
DEFAULT_NICENESS,
DEFAULT_SCANINFO_STORE_TIME,
DEFAULT_CONFIG_PATH,
DEFAULT_UNIX_SOCKET_PATH,
DEFAULT_PID_PATH,
DEFAULT_LOCKFILE_DIR_PATH,
)


Expand Down Expand Up @@ -94,4 +98,8 @@ def test_defaults(self):
self.assertEqual(args.log_level, logging.WARNING)
self.assertEqual(args.address, DEFAULT_ADDRESS)
self.assertEqual(args.port, DEFAULT_PORT)
self.assertEqual(args.port, DEFAULT_SCANINFO_STORE_TIME)
self.assertEqual(args.scaninfo_store_time, DEFAULT_SCANINFO_STORE_TIME)
self.assertEqual(args.config, DEFAULT_CONFIG_PATH)
self.assertEqual(args.unix_socket, DEFAULT_UNIX_SOCKET_PATH)
self.assertEqual(args.pid_file, DEFAULT_PID_PATH)
self.assertEqual(args.lock_file_dir, DEFAULT_LOCKFILE_DIR_PATH)