Merge ~smoser/cloud-init:bug/1683038-ec2-no-warn-on-explicit into cloud-init:master
| Status: | Work in progress |
|---|---|
| Proposed branch: | ~smoser/cloud-init:bug/1683038-ec2-no-warn-on-explicit |
| Merge into: | cloud-init:master |
| Diff against target: |
373 lines (+318/-10) 2 files modified
cloudinit/sources/DataSourceEc2.py (+44/-10) tests/unittests/test_datasource/test_ec2.py (+274/-0) |
| Related bugs: |
| Reviewer | Review Type | Date Requested | Status |
|---|---|---|---|
| Server Team CI bot | continuous-integration | Approve on 2017-05-31 | |
| Chad Smith | Approve on 2017-05-24 | ||
| cloud-init commiters | 2017-05-18 | Pending | |
|
Review via email:
|
|||
Commit Message
Ec2: do not warn user of strict if Ec2 is explicitly set.
If the system is configured with datasource_list of either just
'Ec2' or 'Ec2' and 'None', then consider this as if they had set
strict_id = true. A change is made to the signature of
'warn_if_necessary' to make unit testing easier.
Additionally, fix a bug in ds-identify. If the user configured:
datasource_list: ["Ec2", "None"]
then ds-identify would write
datasource_list: ["Ec2", "None", "None"]
which would break the logic to avoid warning.
LP: #1683038
| Ryan Harper (raharper) wrote : | # |
Generally looks fine, one question w.r.t confirming explict_dslist check
| Scott Moser (smoser) wrote : | # |
On Mon, 22 May 2017, Ryan Harper wrote:
> Generally looks fine, one question w.r.t confirming explict_dslist check
>
> Diff comments:
>
> > diff --git a/cloudinit/
> > index 2f9c7ed..818a639 100644
> > --- a/cloudinit/
> > +++ b/cloudinit/
> > @@ -266,6 +267,12 @@ def parse_strict_
> > return mode, sleep
> >
> >
> > +def _is_explicit_
> > + if 'Ec2' not in dslist:
> > + return False
> > + return (len(dslist) == 1 or (len(dslist) == 2 and 'None' in dslist))
>
> if we know dslist is len == 2, then We could ensure it looks like:
> ['Ec2', None]
>
> Right? That's exactly what we're looking for? Verus this [None, 'Ec2']
> which would pass this test but not be what we're looking for IIUC
Yeah, I avoided checking for 'Ec2' because if this datasoruce is running,
then Ec2 is in the list. But I think it makes more sense to be explicit
Will cahnge as you sigguested.
if dslist == ['Ec2', 'None'] or dslist == ['Ec2']
sm
| Scott Moser (smoser) wrote : | # |
some responses in line. i'll fix some things too. thanks for review.
| Scott Moser (smoser) wrote : | # |
I've pushed some new commits, please see and review.
thanks.
PASSED: Continuous integration, rev:d0e1e415ef2
https:/
Executed test runs:
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
Click here to trigger a rebuild:
https:/
PASSED: Continuous integration, rev:194e15a6785
https:/
Executed test runs:
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
Click here to trigger a rebuild:
https:/
| Chad Smith (chad.smith) wrote : | # |
pre-approved on assumption of a new unit test for behavior, if the following branch[1] lands before this one you could create a CiTestCase setting with_logs = True and self.assertIn(" not warning", self.logs.
References:
[1] https:/
| Scott Moser (smoser) wrote : | # |
I split the ds-identify portion out into
https:/
that way i can get it in now, and fix the ec2 warn portion itself with a nice test.
PASSED: Continuous integration, rev:4556902992e
https:/
Executed test runs:
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
Click here to trigger a rebuild:
https:/
- e8fcbfd... by Scott Moser on 2017-05-30
- c4d0d40... by Scott Moser on 2017-05-30
FAILED: Continuous integration, rev:0c5f1e428c0
https:/
Executed test runs:
FAILURE: https:/
FAILURE: https:/
FAILURE: https:/
FAILURE: https:/
FAILURE: https:/
Click here to trigger a rebuild:
https:/
- 092ea40... by Scott Moser on 2017-05-31
| Scott Moser (smoser) wrote : | # |
I have to think some more on the 'FIXME' bits here.
But i'd like feedback on teh added unit tests.
FAILED: Continuous integration, rev:4999cd8ef76
https:/
Executed test runs:
FAILURE: https:/
FAILURE: https:/
FAILURE: https:/
FAILURE: https:/
FAILURE: https:/
Click here to trigger a rebuild:
https:/
PASSED: Continuous integration, rev:092ea4027f2
https:/
Executed test runs:
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
Click here to trigger a rebuild:
https:/
- a247285... by Scott Moser on 2017-05-31
PASSED: Continuous integration, rev:a2472853a66
https:/
Executed test runs:
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
Click here to trigger a rebuild:
https:/
| Scott Moser (smoser) wrote : | # |
I think that the signature change is fine.
the other fixme I think is best fixed by just having ds-identify write an entry in the config that says that it wrote a datasource_list, and how it did that.
Ie, it could declare that it essentially copied the datasource list like this:
di_datasourc
or something to that affect. Then cloud-init could read that. A 'copy' there would be different than 'search'. The copy would show no warning, but the search would.
I'm not sure stil..
We *should* grab the other parts of this merge proposal and get them into main.
| Scott Moser (smoser) wrote : | # |
I grabbed the initial test portions of this merge proposal and put them into another
at https:/
note, those do not have the tests for WarnIfNecessary
Unmerged commits
- a247285... by Scott Moser on 2017-05-31
- 092ea40... by Scott Moser on 2017-05-31
- c4d0d40... by Scott Moser on 2017-05-30
- e8fcbfd... by Scott Moser on 2017-05-30
- e358e2f... by Scott Moser on 2017-05-18


PASSED: Continuous integration, rev:11c0967458c be80e36f64ee53c 47d0a448a3e137 /jenkins. ubuntu. com/server/ job/cloud- init-ci/ 351/ /jenkins. ubuntu. com/server/ job/cloud- init-ci/ nodes=metal- amd64/351 /jenkins. ubuntu. com/server/ job/cloud- init-ci/ nodes=metal- arm64/351 /jenkins. ubuntu. com/server/ job/cloud- init-ci/ nodes=metal- ppc64el/ 351 /jenkins. ubuntu. com/server/ job/cloud- init-ci/ nodes=vm- i386/351
https:/
Executed test runs:
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
Click here to trigger a rebuild: /jenkins. ubuntu. com/server/ job/cloud- init-ci/ 351/rebuild
https:/