예제 #1
0
def Main():
    """Main routine.

  """
    opts = ParseOptions()

    utils.SetupToolLogging(opts.debug,
                           opts.verbose,
                           toolname=os.path.splitext(
                               os.path.basename(__file__))[0])

    try:
        data = common.LoadData(sys.stdin.read(), _DATA_CHECK)

        # Check if input data is correct
        common.VerifyClusterName(data, JoinError, constants.SSHS_CLUSTER_NAME)
        common.VerifyCertificateSoft(data, JoinError)

        # Update SSH files
        UpdateSshDaemon(data, opts.dry_run)
        UpdateSshRoot(data, opts.dry_run)

        logging.info("Setup finished successfully")
    except Exception, err:  # pylint: disable=W0703
        logging.debug("Caught unhandled exception", exc_info=True)

        (retcode, message) = cli.FormatError(err)
        logging.error(message)

        return retcode
예제 #2
0
def Main():
    """Main routine.

  """
    opts = ParseOptions()

    utils.SetupToolLogging(opts.debug, opts.verbose)

    try:
        data = common.LoadData(sys.stdin.read(), _DATA_CHECK)

        # Check if input data is correct
        common.VerifyClusterName(data, SshUpdateError,
                                 constants.SSHS_CLUSTER_NAME)
        common.VerifyCertificateSoft(data, SshUpdateError)

        # Update / Generate SSH files
        UpdateAuthorizedKeys(data, opts.dry_run)
        UpdatePubKeyFile(data, opts.dry_run)
        GenerateRootSshKeys(data, opts.dry_run)

        logging.info("Setup finished successfully")
    except Exception, err:  # pylint: disable=W0703
        logging.debug("Caught unhandled exception", exc_info=True)

        (retcode, message) = cli.FormatError(err)
        logging.error(message)

        return retcode
예제 #3
0
 def testNoCert(self):
   common.VerifyCertificateSoft({}, error_fn=prepare_node_join.JoinError,
                                _verify_fn=NotImplemented)