Merge ~johnguthrie/cloud-init:instance_hostname_subst_for_chef into cloud-init:master
| Status: | Rejected |
|---|---|
| Rejected by: | Chad Smith on 2017-11-27 |
| Proposed branch: | ~johnguthrie/cloud-init:instance_hostname_subst_for_chef |
| Merge into: | cloud-init:master |
| Diff against target: |
70 lines (+23/-0) 2 files modified
cloudinit/config/cc_chef.py (+10/-0) cloudinit/util.py (+13/-0) |
| Related bugs: |
| Reviewer | Review Type | Date Requested | Status |
|---|---|---|---|
| Chad Smith | 2017-10-05 | Disapprove on 2017-11-27 | |
| Server Team CI bot | continuous-integration | Approve on 2017-10-06 | |
|
Review via email:
|
|||
Description of the Change
Substitutions in cloud config data when using chef
In cloudinit/
I know that right now, this is a bit AWS-centric, but I hope to add some more intelligence to determine stripped instance IDs for use with other services.
- faba968... by John Guthrie <email address hidden> on 2017-10-06
FAILED: Continuous integration, rev:faba9686ccf
https:/
Executed test runs:
SUCCESS: Checkout
FAILED: Unit & Style Tests
Click here to trigger a rebuild:
https:/
- 38cafcc... by John Guthrie <email address hidden> on 2017-10-06
FAILED: Continuous integration, rev:38cafcc3fee
https:/
Executed test runs:
SUCCESS: Checkout
FAILED: Unit & Style Tests
Click here to trigger a rebuild:
https:/
- e9c9955... by John Guthrie <email address hidden> on 2017-10-06
PASSED: Continuous integration, rev:e9c9955bcfa
https:/
Executed test runs:
SUCCESS: Checkout
SUCCESS: Unit & Style Tests
SUCCESS: Ubuntu LTS: Build
SUCCESS: Ubuntu LTS: Integration
SUCCESS: MAAS Compatability Testing
IN_PROGRESS: Declarative: Post Actions
Click here to trigger a rebuild:
https:/
| John Guthrie (johnguthrie) wrote : | # |
I justs linked bug https:/
| Chad Smith (chad.smith) wrote : | # |
Thanks John for this submittal I'll talk with the team tomorrow and see what folks think about this approach.
While this branch is trying to solve a corner case I feel like we may need to go with a more general framework as you suggested. I have a branch up that'd be the foundation for such a framework [1], as it provides standardized field names which I believe we could ultimately use to substitute cloud-init instance-data variables into any cloud-init module configuration template.
As per stripping the the leading 'i-', it feels very 'corner-casey'. I think we might need a more generic facility for manipulating instance data variables. I'll try to see if I can draw up something that we can poke holes in.
References:
[1] https:/
| Scott Moser (smoser) wrote : | # |
More references
https:/
Thats our trello card for this.
| Chad Smith (chad.smith) wrote : | # |
Updated work-in-progress branch that I'll probably sort out next week on this. It's a more generic approach that let's you use jinja templates in any cloud config module
https:/
The examples I posted were for custom scripts and puppet, but the same applies to chef.
The jinja template supports the following needs you expressed:
- %i could be serviced in jinja with {{ v1.instance_
- %f serviced by {{ v1.fqdn }}
the benefit here, is a generic application for all modules, not just chef
| Chad Smith (chad.smith) wrote : | # |
Thank you again for this sensible suggestion. As mentioned in the above comment ([1]),
we'll make sure to fold in the use cases suggested here into the general jinja templater for cloud-config modules in the branch at [2]. I'll mark as disapprove/rejected as the general templater should provide the template variable you requested, and much more. Thanks again for getting the ball rolling here.
This means you can provide your cloud-config with the following:
## template: jinja
#cloud-config
chef:
node_name: {{ v1.instance_
references:
[1]: https:/
[2] https:/
Unmerged commits
- e9c9955... by John Guthrie <email address hidden> on 2017-10-06
- 38cafcc... by John Guthrie <email address hidden> on 2017-10-06
- faba968... by John Guthrie <email address hidden> on 2017-10-06
- 0075d7f... by John Guthrie <email address hidden> on 2017-10-05


FAILED: Continuous integration, rev:0075d7fc499 8acc008f5700720 f440915dfc6890 /jenkins. ubuntu. com/server/ job/cloud- init-ci/ 389/
https:/
Executed test runs:
SUCCESS: Checkout
FAILED: Unit & Style Tests
Click here to trigger a rebuild: /jenkins. ubuntu. com/server/ job/cloud- init-ci/ 389/rebuild
https:/