Skip to content
This repository has been archived by the owner on Feb 12, 2023. It is now read-only.

Issue 312 fix aggregate config #318

Merged
merged 9 commits into from Sep 28, 2018
Merged

Issue 312 fix aggregate config #318

merged 9 commits into from Sep 28, 2018

Conversation

ggalmazor
Copy link
Contributor

@ggalmazor ggalmazor commented Sep 25, 2018

Closes #312

This PR improves the aggregate-config tool that we ship in the Aggregate VM:

  • Added a new --net-mode argument that will accept either nat or bridge values to adapt Tomcat's and Aggregate's configuration to the current VM network device mode.

This PR also simplifies the shell command to get the IP addresses on the VM for the MOTD.

What has been done to verify that this works as intended?

Run the commands in the VM, having changed back and forth the network device. Verified that Aggregate was reachable in both nat and bridge scenarios.

Why is this the best possible solution? Were any other approaches considered?

No other approaches considered for this change.

Are there any risks to merging this code? If so, what are they?

Nope.

Do we need any specific form for testing your changes? If so, please attach one

No.

Does this change require updates to documentation? If so, please file an issue at https://github.com/opendatakit/docs/issues/new and include the link below.

getodk/docs#866

}

if [ ${HELP} = YES ]; then
showHelp
exit 0
fi

if [ ${NET_MODE} != "nat" ] && [ ${NET_MODE} != "bridge" ]; then
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You'll get a unary operator expected error if you don't have a ${NET_MODE} set. The error will happen on line 66, 73, 111, 116.

Related, you might want to run the script through https://www.shellcheck.net to check for other issues.

@@ -1,168 +1,21 @@
<?xml version="1.0" encoding="UTF-8"?>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I typically like keep the stock file and making the necessary changes. I think it makes for easier diffs with the stock file on a default install and the links to the docs are nice too.

But I'm guessing you removed this to make the grepping easier?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's exactly right. I'll add the stock file as well with a .original prefix, just in case

exit 1
fi

if [ ${NET_MODE} == "bridge" ] && ([ -z ${HTTP_PORT} ] || [ -z ${HTTPS_PORT} ]); then
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe I'm confused, but this warning is also valid for NAT mode, no?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not really, but that's mainly because there isn't clear criteria of which args are required which aren't.

I'd propose this:

  • If --http-port is set, then --https-port is required, and vice versa.
  • If --http-port and --https-ports are defined, then --net-mode is required.

(FQDN is always optional)

@yanokwa
Copy link
Member

yanokwa commented Sep 27, 2018

Pretty sure this will require a change in the docs. Can you update the PR description?

@yanokwa
Copy link
Member

yanokwa commented Sep 27, 2018

Overall, this does what it says on the tin. Just some minor tweaks then it can be merged!

- At least an arg must be set
- http-port and https-port must be set together
- net-mode must be set along with http-port and https-port
- net-mode must be one of 'nat' or 'bridge'
@ggalmazor
Copy link
Contributor Author

OK! Added issue in docs repo and applied your suggestions, @yanokwa.

@yanokwa yanokwa merged commit 123fe27 into getodk:master Sep 28, 2018
@ggalmazor ggalmazor deleted the issue_312_fix_aggregate-config branch December 19, 2018 07:59
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants