Skip to content

Commit b7e06fb

Browse files
* Return proper error when no command line arguments are passed * Fix tiagocoutinho#14: broken Dockerfile
1 parent a445a4f commit b7e06fb

File tree

2 files changed

+10
-11
lines changed

2 files changed

+10
-11
lines changed

Dockerfile

+4-6
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,13 @@
11
FROM python:3.8-alpine
22

3-
WORKDIR /src
4-
5-
COPY *.md modbus_proxy.py setup.py *.conf ./
3+
COPY . /src
64

75
# install dependencies to the local user directory
86
RUN pip --disable-pip-version-check --no-input --no-cache-dir --timeout 3 \
9-
install .[yaml]
7+
install src/[yaml]
108

119
# clean up
12-
RUN rm *.md modbus_proxy.py setup.py
10+
RUN rm /src -r
1311

1412
ENTRYPOINT ["modbus-proxy"]
15-
CMD ["--help"]
13+
CMD ["--help"]

src/modbus_proxy.py

+6-5
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,7 @@
2323
"standard": {"format": "%(asctime)s %(levelname)8s %(name)s: %(message)s"}
2424
},
2525
"handlers": {
26-
"console": {
27-
"class": "logging.StreamHandler",
28-
"formatter": "standard",
29-
}
26+
"console": {"class": "logging.StreamHandler", "formatter": "standard"}
3027
},
3128
"root": {"handlers": ["console"], "level": "INFO"},
3229
}
@@ -286,7 +283,11 @@ def parse_args(args=None):
286283
type=str,
287284
help="log configuration file. By default log to stderr with log level = INFO",
288285
)
289-
return parser.parse_args(args=args)
286+
options = parser.parse_args(args=args)
287+
288+
if not options.config_file and not options.modbus:
289+
parser.exit(1, "must give a config-file or/and a --modbus")
290+
return options
290291

291292

292293
def create_config(args):

0 commit comments

Comments
 (0)