Merge lp:~lmic/juju-deployer/juju-deployer-populate-first+add-machine-charm-series into lp:~jason-hobbs/juju-deployer/juju-deployer-populate-first

Proposed by Larry Michel
Status: Needs review
Proposed branch: lp:~lmic/juju-deployer/juju-deployer-populate-first+add-machine-charm-series
Merge into: lp:~jason-hobbs/juju-deployer/juju-deployer-populate-first
Diff against target: 61 lines (+12/-4)
1 file modified
deployer/action/importer.py (+12/-4)
To merge this branch: bzr merge lp:~lmic/juju-deployer/juju-deployer-populate-first+add-machine-charm-series
Reviewer Review Type Date Requested Status
Jason Hobbs Needs Fixing
Review via email: mp+262514@code.launchpad.net
To post a comment you must log in.
Revision history for this message
Jason Hobbs (jason-hobbs) wrote :

Did you test this?

Revision history for this message
Jason Hobbs (jason-hobbs) wrote :

The charm url can't be used to find the charm series - sometimes we deploy trusty charms onto precise and sometimes vice-versa.

review: Needs Fixing
Revision history for this message
Larry Michel (lmic) wrote :

Yes. It works. I had it running all weekend.

On Mon, Jun 22, 2015 at 9:23 AM, Jason Hobbs <email address hidden>
wrote:

> Did you test this?
> --
>
> https://code.launchpad.net/~lmic/juju-deployer/juju-deployer-populate-first+add-machine-charm-series/+merge/262514
> You are the owner of
> lp:~lmic/juju-deployer/juju-deployer-populate-first+add-machine-charm-series.
>

157. By Larry Michel <email address hidden>

only use charm series from url if it's win2012hvr2

Revision history for this message
Larry Michel (lmic) wrote :

> The charm url can't be used to find the charm series - sometimes we deploy
> trusty charms onto precise and sometimes vice-versa.

I added patch to this will only be done for win2012hvr2 series.

Unmerged revisions

157. By Larry Michel <email address hidden>

only use charm series from url if it's win2012hvr2

156. By Larry Michel <email address hidden>

acknowledge series from charm

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'deployer/action/importer.py'
--- deployer/action/importer.py 2015-06-11 20:53:00 +0000
+++ deployer/action/importer.py 2015-06-23 21:25:55 +0000
@@ -183,6 +183,10 @@
183 charm = self.deployment.get_charm_for(svc.name)183 charm = self.deployment.get_charm_for(svc.name)
184 self.log.info(184 self.log.info(
185 " Deploying service %s using %s", svc.name, charm.charm_url)185 " Deploying service %s using %s", svc.name, charm.charm_url)
186
187 # The series will follow : in the url and precede /
188 url_series = (charm.charm_url.split(':')[1]).split('/')[0]
189 charm_series = url_series if url_series is 'win2012hvr2' else None
186190
187 if svc.unit_placement:191 if svc.unit_placement:
188 # We sorted all the non placed services first, so we only192 # We sorted all the non placed services first, so we only
@@ -221,7 +225,7 @@
221 self.log.debug('Pre-allocating machines for %s' % svc.name)225 self.log.debug('Pre-allocating machines for %s' % svc.name)
222 self.log.debug('Deploy base service: %s' % svc.name)226 self.log.debug('Deploy base service: %s' % svc.name)
223 p = placement.get(0)227 p = placement.get(0)
224 machine = self.get_machine(p)228 machine = self.get_machine(p, charm_series)
225 self.log.debug('deploy_services: '229 self.log.debug('deploy_services: '
226 'service=%s unit=0 placement=%s machine=%s' %230 'service=%s unit=0 placement=%s machine=%s' %
227 (svc.name, p, machine))231 (svc.name, p, machine))
@@ -243,7 +247,7 @@
243 placement = self.deployment.get_unit_placement(svc, env_status)247 placement = self.deployment.get_unit_placement(svc, env_status)
244 for uid in range(cur_units, svc.num_units):248 for uid in range(cur_units, svc.num_units):
245 p = placement.get(uid)249 p = placement.get(uid)
246 machine = self.get_machine(p)250 machine = self.get_machine(p, charm_series)
247 self.log.debug('add_units: '251 self.log.debug('add_units: '
248 'service=%s unit=%s placement=%s machine=%s' %252 'service=%s unit=%s placement=%s machine=%s' %
249 (svc.name, uid, p, machine))253 (svc.name, uid, p, machine))
@@ -264,7 +268,7 @@
264 svc.config,268 svc.config,
265 svc.constraints,269 svc.constraints,
266 num_units,270 num_units,
267 self.get_machine(placement.get(0)))271 self.get_machine(placement.get(0), charm_series))
268272
269 if svc.annotations:273 if svc.annotations:
270 self.log.debug(" Setting annotations")274 self.log.debug(" Setting annotations")
@@ -337,7 +341,7 @@
337 int(timeout), watch=self.options.watch,341 int(timeout), watch=self.options.watch,
338 services=self.deployment.get_service_names(), on_errors=on_errors)342 services=self.deployment.get_service_names(), on_errors=on_errors)
339343
340 def get_machine(self, u_idx):344 def get_machine(self, u_idx, charm_series=None):
341 # find the machine id that matches the target machine345 # find the machine id that matches the target machine
342 # unlike juju status output, the dns-name is one of the346 # unlike juju status output, the dns-name is one of the
343 # many values returned from our env.status() in addresses347 # many values returned from our env.status() in addresses
@@ -365,6 +369,10 @@
365369
366 # if we don't find a match, we need to add it370 # if we don't find a match, we need to add it
367 series = self.deployment.data['series']371 series = self.deployment.data['series']
372 if (charm_series != None) and (charm_series != series):
373 # override series if different from deployment series
374 series = charm_series
375
368 mid = self.env.add_specific_machine(u_idx, series)376 mid = self.env.add_specific_machine(u_idx, series)
369 self.deployment.log.debug(377 self.deployment.log.debug(
370 'Waiting for machine to show up in status.')378 'Waiting for machine to show up in status.')

Subscribers

People subscribed via source and target branches

to all changes: