Пример #1
0
def sync_full():
    cloud = env.cloud()

    file_roots = cloud.opts['file_roots']['base'][0]
    pillar_roots = cloud.opts['pillar_roots']['base'][0]

    manifest = Manifest()
    manifest.add('cloudseed/current/srv/salt', file_roots)
    manifest.add('cloudseed/current/srv/pillar', pillar_roots)

    manifest.add('cloudseed/current/salt/cloud.profiles',
                 '/etc/salt/cloud.profiles')

    # the cloud providers may need a rewrite (private_key path
    # if applicable, etc) and the salt-cloud conf will need to know
    # the master's IP for subsequent minions. Changes to salt-cloud
    # conf are fixed, the providers will vary by provider.

    manifest.add('cloudseed/current/salt/cloud.providers',
                 '/etc/salt/cloud.providers')

    _add_saltcloud_conf(manifest, cloud)

    vm_ = cloud.vm_profile('master')
    alias, driver = cloud.lookup_providers(vm_['provider'])

    action = cloud.clouds.get('%s.sync_full_manifest' % driver, lambda x: None)

    action(manifest)

    tmp = tempfile.NamedTemporaryFile(delete=False)
    Archive.tar(tmp, manifest)

    _sync_full_action(tmp.name, cloud)
Пример #2
0
def sync_partial():
    cloud = env.cloud()

    file_roots = cloud.opts['file_roots']['base'][0]
    pillar_roots = cloud.opts['pillar_roots']['base'][0]

    manifest = Manifest()
    manifest.add('cloudseed/current/srv/salt', file_roots)
    manifest.add('cloudseed/current/srv/pillar', pillar_roots)

    manifest.add(
        'cloudseed/current/salt/cloud.profiles',
        '/etc/salt/cloud.profiles')

    vm_ = cloud.vm_profile('master')
    alias, driver = cloud.lookup_providers(vm_['provider'])

    action = cloud.clouds.get(
        '%s.sync_partial_manifest' % driver, lambda x: None)

    action(manifest)

    tmp = tempfile.NamedTemporaryFile(delete=False)
    Archive.tar(tmp, manifest)
    _sync_partial_action(tmp.name, cloud)
Пример #3
0
def sync_full():
    cloud = env.cloud()

    file_roots = cloud.opts['file_roots']['base'][0]
    pillar_roots = cloud.opts['pillar_roots']['base'][0]

    manifest = Manifest()
    manifest.add('cloudseed/current/srv/salt', file_roots)
    manifest.add('cloudseed/current/srv/pillar', pillar_roots)

    manifest.add(
        'cloudseed/current/salt/cloud.profiles',
        '/etc/salt/cloud.profiles')

    # the cloud providers may need a rewrite (private_key path
    # if applicable, etc) and the salt-cloud conf will need to know
    # the master's IP for subsequent minions. Changes to salt-cloud
    # conf are fixed, the providers will vary by provider.

    manifest.add(
        'cloudseed/current/salt/cloud.providers',
        '/etc/salt/cloud.providers')

    _add_saltcloud_conf(manifest, cloud)

    vm_ = cloud.vm_profile('master')
    alias, driver = cloud.lookup_providers(vm_['provider'])

    action = cloud.clouds.get(
        '%s.sync_full_manifest' % driver, lambda x: None)

    action(manifest)

    tmp = tempfile.NamedTemporaryFile(delete=False)
    Archive.tar(tmp, manifest)

    _sync_full_action(tmp.name, cloud)
Пример #4
0
def sync_partial():
    cloud = env.cloud()

    file_roots = cloud.opts['file_roots']['base'][0]
    pillar_roots = cloud.opts['pillar_roots']['base'][0]

    manifest = Manifest()
    manifest.add('cloudseed/current/srv/salt', file_roots)
    manifest.add('cloudseed/current/srv/pillar', pillar_roots)

    manifest.add('cloudseed/current/salt/cloud.profiles',
                 '/etc/salt/cloud.profiles')

    vm_ = cloud.vm_profile('master')
    alias, driver = cloud.lookup_providers(vm_['provider'])

    action = cloud.clouds.get('%s.sync_partial_manifest' % driver,
                              lambda x: None)

    action(manifest)

    tmp = tempfile.NamedTemporaryFile(delete=False)
    Archive.tar(tmp, manifest)
    _sync_partial_action(tmp.name, cloud)