-
Notifications
You must be signed in to change notification settings - Fork 38
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
gw: fix config and systemd example generation
- Loading branch information
1 parent
f5c96ba
commit 24b2360
Showing
2 changed files
with
13 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -16,7 +16,7 @@ The following commands will set up a gateway instance named ``mygw`` on a Linux | |
sudo python -m p4p.gw --example-config /etc/pvagw/mygw.conf | ||
# generate a systemd unit file to support the gateway | ||
sudo python -m p4p.gw --example-systemd \ | ||
/etc/systemd/system/[email protected] | ||
/etc/systemd/system/pvagw@mygw.service | ||
# start the gateway | ||
sudo systemctl daemon-reload | ||
sudo systemctl start [email protected] | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -745,21 +745,28 @@ def main(args=None): | |
args = getargs().parse_args(args) | ||
|
||
catfile = None | ||
conf = '/etc/pvagw/%i.conf' | ||
I = '%i' | ||
if args.example_config: | ||
catfile = 'example.conf' | ||
I = os.path.splitext(os.path.basename(args.config))[0] | ||
conf = os.path.abspath(args.config) | ||
elif args.example_systemd: | ||
catfile = '[email protected]' | ||
inst = os.path.splitext(os.path.basename(args.config))[0].split('@') | ||
if len(inst) == 2 and inst[1]: | ||
I = inst[1] | ||
conf = '/etc/pvagw/{0}.conf'.format(I) | ||
|
||
if catfile is not None: | ||
if args.config=='-': | ||
O = sys.stdout | ||
I = '%i' | ||
conf = '/etc/pvagw/%i.conf' | ||
print('# eg. save as /etc/systemd/system/[email protected]', file=sys.stderr) | ||
if args.example_config: | ||
print('# eg. save as /etc/pvagw/<instance>.conf', file=sys.stderr) | ||
elif args.example_systemd: | ||
print('# eg. save as /etc/systemd/system/pvagw@<instance>.service', file=sys.stderr) | ||
else: | ||
O = open(args.config, 'w') | ||
I = os.path.splitext(os.path.basename(args.config))[0] | ||
conf = os.path.abspath(args.config) | ||
|
||
pythonpath=os.environ.get('PYTHONPATH','').split(os.pathsep) | ||
modroot = os.path.dirname(os.path.dirname(__file__)) # directory containing p4p/gw.py | ||
|