~free.ekanayaka/landscape-client/jaunty-1.5.4-0ubuntu0.9.04.0

« back to all changes in this revision

Viewing changes to landscape/configuration.py

  • Committer: Free Ekanayaka
  • Date: 2010-08-04 20:06:59 UTC
  • Revision ID: free.ekanayaka@canonical.com-20100804200659-w6rqbjz6wg9w3npc
* New upstream version (LP: #610744):
  - The Eucalyptus management plugin reports the output of the
    'euca-describe-availability-zones verbose' command, which includes
    information about the available instance types and the maximum
    number of each instance type that the cloud can support (LP: #599338)
  - Check if the package directory exists before trying to check the
    package changer lock in the dbus-proxy. This fixes a bug when upgrading
    a dbus-landscape which never registered (LP: #603514).
  - Allow an LDS server to bootstrap new cloud instances with its own CA,
    which is picked up by the client, written to a file on the instance, and
    used in subsequent exchanges with the server (LP: #605079).
  - Skip loopback interface when reporting device info (LP: #608314)
  - Disable landscape-sysinfo when load is more than 1 (LP: #608278)

Show diffs side-by-side

added added

removed removed

Lines of Context:
454
454
        script = LandscapeSetupScript(config)
455
455
        script.run()
456
456
 
 
457
    # WARNING: ssl_public_key is misnamed, it's not the key of the certificate,
 
458
    # but the actual certificate itself.
457
459
    if config.ssl_public_key and config.ssl_public_key.startswith("base64:"):
458
 
        key_filename = config.get_config_filename() + ".ssl_public_key"
459
 
        print_text("Writing SSL CA certificate to %s..." % key_filename)
460
 
        decoded_key = base64.decodestring(config.ssl_public_key[7:])
461
 
        key_file = open(key_filename, "w")
462
 
        key_file.write(decoded_key)
463
 
        key_file.close()
464
 
        config.ssl_public_key = key_filename
 
460
        decoded_cert = base64.decodestring(config.ssl_public_key[7:])
 
461
        config.ssl_public_key = store_public_key_data(
 
462
            config, decoded_cert)
465
463
 
466
464
    config.write()
467
465
    # Restart the client to ensure that it's using the new configuration.
478
476
            sys.exit(exit_code)
479
477
 
480
478
 
 
479
def store_public_key_data(config, certificate_data):
 
480
    """
 
481
    Write out the data from the SSL certificate provided to us, either from a
 
482
    bootstrap.conf file, or from EC2-style user-data.
 
483
 
 
484
    @param config:  The L{BrokerConfiguration} object in use.
 
485
    @param certificate_data: a string of data that represents the contents of
 
486
    the file to be written.
 
487
    @return the L{BrokerConfiguration} object that was passed in, updated to
 
488
    reflect the path of the ssl_public_key file.
 
489
    """
 
490
    key_filename = os.path.join(config.data_path,
 
491
        os.path.basename(config.get_config_filename() + ".ssl_public_key"))
 
492
    print_text("Writing SSL CA certificate to %s..." % key_filename)
 
493
    key_file = open(key_filename, "w")
 
494
    key_file.write(certificate_data)
 
495
    key_file.close()
 
496
    return key_filename
 
497
 
 
498
 
481
499
def register(config, reactor=None):
482
500
    """Instruct the Landscape Broker to register the client.
483
501