Merge lp:~cprov/snappy-proposed-image-builder/logging into lp:snappy-proposed-image-builder

Proposed by Celso Providelo
Status: Merged
Approved by: Celso Providelo
Approved revision: no longer in the source branch.
Merged at revision: 7
Proposed branch: lp:~cprov/snappy-proposed-image-builder/logging
Merge into: lp:snappy-proposed-image-builder
Diff against target: 46 lines (+7/-25)
1 file modified
snappy_proposed_image_builder/constants.py (+7/-25)
To merge this branch: bzr merge lp:~cprov/snappy-proposed-image-builder/logging
Reviewer Review Type Date Requested Status
Celso Providelo (community) Approve
Review via email: mp+260421@code.launchpad.net

Commit message

Adjust logstash service/solution name and hostname (plain socket gethostname()).

Description of the change

Adjust logstash service/solution name and hostname (plain socket gethostname()).

To post a comment you must log in.
Revision history for this message
Celso Providelo (cprov) wrote :

Self-approving because I am evil!

review: Approve
7. By Celso Providelo

Adjust logstash service/solution name and hostname (plain socket gethostname()). [r=Celso Providelo]

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'snappy_proposed_image_builder/constants.py'
2--- snappy_proposed_image_builder/constants.py 2015-05-27 19:13:29 +0000
3+++ snappy_proposed_image_builder/constants.py 2015-05-28 05:37:06 +0000
4@@ -17,35 +17,17 @@
5
6 """Constants for this service."""
7
8+import socket
9+
10 API_VERSION = "v1"
11
12 RETRY_COUNT = 3
13
14-SOLUTION_NAME = "snappy-proposed-image-testing"
15-
16-SERVICE_NAME = "snappy-proposed-image-builder"
17-
18-
19-def _get_hostname():
20- """Return sanitized contents of /etc/hostname.
21-
22- It is necessary because current juju hostnames (juju-<env-name>-machine-#)
23- are too big due to our long environment names ('<spec_name>-<MD5>').
24- Linux (DNS for RFC1035, really) only supports labels up to 64 chars and
25- the fallback varies from tool to tool, `cloud-init` chokes on longer
26- names and sets 'ubuntu' (which is the value considered by socket.get*),
27- `hostnamectl` (systemd) would truncate the given data.
28-
29- None of this is ideal to our applications, that's why we will operate
30- on the pristine /etc/hostname and remove the 'juju-' and '-machine' terms
31- added by juju.
32- """
33- with open('/etc/hostname') as fd:
34- hostname = fd.read()
35- return hostname.replace('juju-', '').replace('-machine', '').strip()
36-
37-
38-HOSTNAME = _get_hostname()
39+SOLUTION_NAME = "snappy-proposed"
40+
41+SERVICE_NAME = "image-builder"
42+
43+HOSTNAME = socket.gethostname()
44
45 LOGGING_EXTRA = {
46 'solution': SOLUTION_NAME,

Subscribers

People subscribed via source and target branches