Beispiel #1
0
def do_move_in_panopticon(source_topic, destination_topic):
    util.use_random_host('class-backend')
    print("\nRetagging content on %s" % (api.env.host_string, ))
    util.rake('panopticon',
              'move_content_to_new_topic',
              source=source_topic,
              dest=destination_topic)
Beispiel #2
0
def reindex_app(app):
    puts("Rebuilding search index for application '%s'" % app)

    machine_class, rake_tasks = SEARCHABLE_APPS[app]
    util.use_random_host('class-%s' % machine_class)

    for rake_task in rake_tasks:
        util.rake(app, rake_task)
Beispiel #3
0
def prepare_publisher_csv(output_directory, source_topic, destination_topic):
    util.use_random_host('class-backend')
    print("\nFetching publisher change CSV from %s" % (api.env.host_string, ))

    filename = build_filename('publisher', source_topic, destination_topic)
    remote_path = '/var/apps/publisher/tmp/%s' % (filename, )
    util.rake('publisher', 'topic_changes:prepare', source_topic,
              destination_topic, remote_path)
    api.get(remote_path, os.path.join(output_directory, filename))
    api.sudo("rm '%s'" % (remote_path, ), user="******")
def prepare_publisher_csv(output_directory, source_topic, destination_topic):
    util.use_random_host('class-backend')
    print("\nFetching publisher change CSV from %s" % (api.env.host_string,))

    filename = build_filename('publisher', source_topic, destination_topic)
    remote_path = '/var/apps/publisher/tmp/%s' % (filename,)
    util.rake('publisher', 'topic_changes:prepare',
              source_topic,
              destination_topic,
              remote_path)
    api.get(remote_path, os.path.join(output_directory, filename))
    api.sudo("rm '%s'" % (remote_path,), user="******")
Beispiel #5
0
def restore_snapshot(snapshot, groups_to_restore):
    """Restore snapshots to new indices.

    `groups_to_restore` is either 'all' or a comma separated list of aliases.
    """
    util.rake('rummager',
              'rummager:snapshot:restore',
              snapshot,
              RUMMAGER_INDEX=groups_to_restore)

    puts(
        "After the recovery is complete, switch to the new indexes with rummager.switch_group_to_index"
    )
def reindex_app(app):
    puts("Rebuilding search index for application '%s'" % app)

    machine_class, tasks = SEARCHABLE_APPS[app]
    util.use_random_host('class-%s' % machine_class)

    for task in tasks:
        # FIXME: Remove this horrible hack of a hack for a hack
        if app == 'recommended-links':
            with cd('/data/vhost/recommended-links.*/current'):
                sudo('govuk_setenv default bundle exec rake -v "%s" --trace' % task, user='******')
        else:
            util.rake(app, task)
def prepare_whitehall_csv(output_directory, source_topic, destination_topic):
    util.use_random_host('class-whitehall_backend')
    print("\nFetching whitehall change CSV from %s" % (api.env.host_string,))

    filename = build_filename('whitehall', source_topic, destination_topic)
    remote_path = '/var/apps/whitehall/tmp/%s' % (filename,)
    util.rake('whitehall', 'topic_retagging_csv_export',
              SOURCE=source_topic,
              DESTINATION=destination_topic,
              CSV_LOCATION=remote_path,
              )
    api.get(remote_path, os.path.join(output_directory, filename))
    api.sudo("rm '%s'" % (remote_path,), user="******")
Beispiel #8
0
def process_publisher_csv(path):
    filename = os.path.basename(path)
    print("\nApplying publisher change CSV %s on %s" % (
        filename,
        api.env.host_string,
    ))
    if file_length(path) == 1:
        print("No changes in file - skipping")
        return

    remote_path = '/var/apps/publisher/tmp/%s' % (filename, )
    api.put(path, remote_path, use_sudo=True)
    util.rake('publisher', 'topic_changes:process', remote_path)
    api.sudo("rm '%s'" % (remote_path, ))
def process_publisher_csv(path):
    filename = os.path.basename(path)
    print("\nApplying publisher change CSV %s on %s" % (
        filename,
        api.env.host_string,
    ))
    if file_length(path) == 1:
        print("No changes in file - skipping")
        return

    remote_path = '/var/apps/publisher/tmp/%s' % (filename, )
    api.put(path, remote_path, use_sudo=True)
    util.rake('publisher', 'topic_changes:process', remote_path)
    api.sudo("rm '%s'" % (remote_path,))
Beispiel #10
0
def prepare_whitehall_csv(output_directory, source_topic, destination_topic):
    util.use_random_host('class-whitehall_backend')
    print("\nFetching whitehall change CSV from %s" % (api.env.host_string, ))

    filename = build_filename('whitehall', source_topic, destination_topic)
    remote_path = '/var/apps/whitehall/tmp/%s' % (filename, )
    util.rake(
        'whitehall',
        'topic_retagging_csv_export',
        SOURCE=source_topic,
        DESTINATION=destination_topic,
        CSV_LOCATION=remote_path,
    )
    api.get(remote_path, os.path.join(output_directory, filename))
    api.sudo("rm '%s'" % (remote_path, ), user="******")
Beispiel #11
0
def process_whitehall_csv(path):
    filename = os.path.basename(path)
    print("\nApplying whitehall change CSV %s on %s" % (
        filename,
        api.env.host_string,
    ))
    if file_length(path) == 1:
        print("No changes in file - skipping")
        return

    remote_path = '/var/apps/whitehall/tmp/%s' % (filename, )
    api.put(path, remote_path, use_sudo=True)
    util.rake('whitehall', 'process_topic_retagging_csv',
              CSV_LOCATION=remote_path)
    api.sudo("rm '%s'" % (remote_path,))
Beispiel #12
0
def process_whitehall_csv(path):
    filename = os.path.basename(path)
    print("\nApplying whitehall change CSV %s on %s" % (
        filename,
        api.env.host_string,
    ))
    if file_length(path) == 1:
        print("No changes in file - skipping")
        return

    remote_path = '/var/apps/whitehall/tmp/%s' % (filename, )
    api.put(path, remote_path, use_sudo=True)
    util.rake('whitehall',
              'process_topic_retagging_csv',
              CSV_LOCATION=remote_path)
    api.sudo("rm '%s'" % (remote_path, ))
Beispiel #13
0
def schedule_publications():
    """Publish overdue scheduled publications"""
    util.rake('whitehall', 'publishing:overdue:publish')
Beispiel #14
0
def unpublish_statistics_announcement(*slugs):
    """Unpublish statistics announcements and register 410 GONE routes"""
    for slug in slugs:
        util.rake('whitehall', 'unpublish_statistics_announcement', slug)
Beispiel #15
0
def do_delete_topic(old_topic):
    util.use_random_host('class-backend')
    print("\nDeleting old topic %s" % (old_topic,))
    util.rake('panopticon', 'specialist_sector_cleanup', SLUG=old_topic)
Beispiel #16
0
def list_snapshots():
    """List rummager snapshots"""
    util.rake('rummager', 'rummager:snapshot:list')
Beispiel #17
0
def find_snapshot_for_date(date):
    """Find the latest rummager snapshot before a date (YYYY-mm-dd HH:MM:SS)"""
    util.rake('rummager', 'rummager:snapshot:latest', date)
Beispiel #18
0
def find_latest_snapshot():
    """Find the latest rummager snapshot"""
    util.rake('rummager', 'rummager:snapshot:latest')
Beispiel #19
0
def overdue_scheduled_publications():
    """List overdue scheduled publications"""
    util.rake('whitehall', 'publishing:overdue:list')
Beispiel #20
0
def switch_group_to_index(group, index_name):
    """Point a rummager index alias to a new index"""
    util.rake('rummager',
              'rummager:switch_to_named_index',
              index_name,
              RUMMAGER_INDEX=group)
Beispiel #21
0
def do_delete_topic(old_topic):
    util.use_random_host('class-backend')
    print("\nDeleting old topic %s" % (old_topic, ))
    util.rake('panopticon', 'specialist_sector_cleanup', SLUG=old_topic)
Beispiel #22
0
def overdue_scheduled_publications():
    """List overdue scheduled publications"""
    util.rake('whitehall', 'publishing:overdue:list')
Beispiel #23
0
def unarchive_content(*edition_ids):
    """Unarchive Whitehall content"""
    for edition_id in edition_ids:
        util.rake('whitehall', 'unwithdraw_edition', edition_id)
def change(old_url, new_url):
    """Change a mainstream slug. Usage: fab integration mainstream_slugs.change:old_slug=/old-slug,new_slug=/new-slug"""
    util.use_random_host('class-backend')
    util.rake('panopticon', 'delete_mainstream_slug_from_search', old_url)
    util.rake('publisher', 'update_mainstream_slug', old_url, new_url)
Beispiel #25
0
def unpublish_statistics_announcement(*slugs):
    """Unpublish statistics announcements and register 410 GONE routes"""
    for slug in slugs:
        util.rake('whitehall', 'unpublish_statistics_announcement', slug)
Beispiel #26
0
def do_move_in_panopticon(source_topic, destination_topic):
    util.use_random_host('class-backend')
    print("\nRetagging content on %s" % (api.env.host_string,))
    util.rake('panopticon', 'move_content_to_new_topic',
              source=source_topic, dest=destination_topic)
Beispiel #27
0
def schedule_publications():
    """Publish overdue scheduled publications"""
    util.rake('whitehall', 'publishing:overdue:publish')
def change(old_url, new_url):
    """Change a mainstream slug. Usage: fab preview mainstream_slugs.change:old_slug=/old-slug,new_slug=/new-slug"""
    util.use_random_host('class-backend')
    util.rake('panopticon', 'delete_mainstream_slug_from_search', old_url)
    util.rake('publisher', 'update_mainstream_slug', old_url, new_url)
def change(old_url, new_url):
    """Change a mainstream slug. Usage: fab integration mainstream_slugs.change:old_slug=/old-slug,new_slug=/new-slug"""
    util.use_random_host("class-backend")
    util.rake("panopticon", "delete_mainstream_slug_from_search", old_url)
    util.rake("publisher", "update_mainstream_slug", old_url, new_url)