Merge lp://staging/~hloeung/charms/trusty/apache2/open-the-ports-please into lp://staging/charms/trusty/apache2
Status: | Merged |
---|---|
Merged at revision: | 73 |
Proposed branch: | lp://staging/~hloeung/charms/trusty/apache2/open-the-ports-please |
Merge into: | lp://staging/charms/trusty/apache2 |
Diff against target: |
16 lines (+2/-3) 1 file modified
hooks/hooks.py (+2/-3) |
To merge this branch: | bzr merge lp://staging/~hloeung/charms/trusty/apache2/open-the-ports-please |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Stuart Bishop (community) | Approve | ||
Robert Bruce Park (community) | Approve | ||
Review via email: mp+306419@code.staging.launchpad.net |
Description of the change
As seen on a production service:
| apache2/0 unknown idle 1.25.6 1 80/tcp 162.213.33.139
Digging into it, it seems that ports.yaml had stale/incorrect information on what ports are open. We should just call open_ports to ensure all are open.
Here's what I did to figure it out and fix it. Excuse my print statements hehe.
Modified:
def ensure_
"""Ensure that only the desired ports are open."""
print("here {}".format(ports))
open_ports = set(get_
print("here open {}".format(
ports = set(ports)
wanted_closed = ports.differenc
print("here closed {}".format(
for port in sorted(
print("here opening {}".format(port))
unwanted_open = open_ports.
print("here unwanted {}".format(
for port in sorted(
print("here closing {}".format(port))
set_
2016-09-22 06:12:02 INFO config-changed here set([80, 443])
2016-09-22 06:12:02 INFO config-changed here open set([80, 443])
2016-09-22 06:12:02 INFO config-changed here closed set([])
2016-09-22 06:12:02 INFO config-changed here unwanted set([])
Deleted ports.yaml:
2016-09-22 06:19:00 INFO config-changed here set([80, 443])
2016-09-22 06:19:00 INFO config-changed here open set([])
2016-09-22 06:19:00 INFO config-changed here closed set([80, 443])
2016-09-22 06:19:00 INFO config-changed here opening 80
2016-09-22 06:19:00 INFO config-changed here opening 443
2016-09-22 06:19:00 INFO config-changed here unwanted set([])
From juju status:
| apache2/0 unknown idle 1.25.6 1 80/tcp,443/tcp 162.213.33.139
lgtm