Exemplo n.º 1
0
def get_manifest(workspace_name):
    if workspace_name is None:
        exit_with_error("No workspace found.")
    workspace_path = workspaces.get_workspace_path(workspace_name)
    manifest_path = workspaces.get_manifest_path(workspace_name)
    try:
        return Manifest(manifest_path, workspace_path)
    except Exception as e:
        exit_with_error(e.message)
Exemplo n.º 2
0
def get_manifest(workspace_name, logfile_path):
    if workspace_name is None:
        workspace_name = workspaces.get_last_workspace_name()
    if workspace_name is None:
        exit_with_error("No workspace found.", logfile_path)
    workspace_path = workspaces.get_workspace_path(workspace_name)
    manifest_path = workspaces.get_manifest_path(workspace_name)
    if not os.path.isfile(manifest_path):
        colorprint.warning(
            "Error: could not find manifest at {}. While it's "
            "not mandatory, it's highly recommended to use one."
            " Read 'README_MANIFEST.md' for more "
            "information.".format(manifest_path), logfile_path)
        return None
    else:
        try:
            return Manifest(manifest_path, workspace_path)
        except Exception as e:
            exit_with_error(e.message, logfile_path)
Exemplo n.º 3
0
    usage = '%s manifest_file' % sys.argv[0]

    try:
        manifest_path = os.path.abspath(sys.argv[1])
    except IndexError:
        print('Usage: %s' % usage)
        sys.exit(1)

    if os.geteuid() != 0:
        print("This script must be run as root.")
        sys.exit(1)

    RUNWAY_DIR = os.path.abspath(os.path.dirname(__file__))

    # need to parse the manifest file first to get the runway options (family)
    man = Manifest(manifest_path, None)

    # create workspace dir from runway_options['family']
    workspaces.WORKSPACE_PREFIX += '%s-' % man.runway_options['family']
    workspace_name = workspaces.get_new_workspace_name()
    workspace_path = workspaces.create_workspace_dir(workspace_name)
    man.workspace_dir = workspace_path

    # get manifest components into workspace
    man.retrieve_components()

    # get a copy of the manifest into the workspace directory
    copyfile(manifest_path, os.path.join(workspace_path, 'manifest.cfg'))

    # make guest etc etc
    container_name = workspace_name
Exemplo n.º 4
0
                        default=None,
                        help="Workspace name")

    args = parser.parse_args()
    manifest_file = os.path.abspath(args.manifest)
    workspace_name = args.workspace

    # Create new workspace directory
    try:
        new_workspace_path = create_workspace_dir(workspace_name)
    except Exception as e:
        exit_with_error(e.message)

    colorprint.info("\nRetrieving components into workspace at '{}'..."
                    "\n".format(new_workspace_path))

    # Copy manifest into workspace
    manifest_copy_path = os.path.join(new_workspace_path, MANIFEST_COPY_NAME)
    if not os.path.isfile(manifest_copy_path):
        copyfile(manifest_file, manifest_copy_path)

    # Retrieve contents
    try:
        current_manifest = Manifest(manifest_copy_path, new_workspace_path)
        current_manifest.retrieve_components()
    except Exception as e:
        exit_with_error(e.message)

    colorprint.success("Guest workspace successfully set up at "
                       "'{}'.".format(new_workspace_path))