~fabricematrat/charmworld/redirect-charm

« back to all changes in this revision

Viewing changes to charmworld/migrations/versions/025_charm_index_two.py

  • Committer: Tarmac
  • Author(s): Brad Crittenden
  • Date: 2014-04-21 15:59:48 UTC
  • mfrom: (501.2.4 comma-migration-2)
  • Revision ID: tarmac-20140421155948-ot1x6l5gu321ul4v
Exodus to remove comma-sep constraints.

Comma-separated constraints in bundles are deprecated.  Currently newly
processed bundles are converted to space-separated on ingestion but there are
a number of old bundles in the db that need fixing.

As this is an exodus, and only one can be present at a time, the 025 exodus is
deleted.

https://codereview.appspot.com/89770044/

R=jcsackett.

Approved by Juju Gui Bot.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
import logging
2
 
from charmworld.migrations.migrate import setup_mongo_indices
3
 
 
4
 
 
5
 
# charm index two
6
 
def exodus_update(source, target, current_version):
7
 
    """Create charm indices.  Copy charms to target.
8
 
 
9
 
    source is the original CharmSource.
10
 
    target is the CharmSource to be used after the exodus.
11
 
    current_version is the version of this exodus.
12
 
    """
13
 
 
14
 
    # Set up the index.
15
 
    log = logging.getLogger('charm.exodus025')
16
 
    log.warning('Starting')
17
 
    charms = target.collection
18
 
    setup_mongo_indices(charms)
19
 
    log.warning('Indices built')
20
 
 
21
 
    # Copy all of the charms over to the target.
22
 
    log.warning('Starting charm copy')
23
 
    for charm in source.collection.find():
24
 
        target.save(charm)
25
 
    log.warning('Finished')