예제 #1
0
    def _export(self, argv):
        self._options = globals.options

        self.__set_root_folder(argv)

        org = self._client.get_organization(argv[0])
        export = Export(globals.options.force)
        export.export_organization(org, self._root)
예제 #2
0
    def _export(self, argv):
        self._options = self._config.options

        self.__set_root_folder(argv)

        org = self._client.get_organization(argv[0])
        export = Export(self._config.options.force)
        export.export_organization(org, self._root)
예제 #3
0
    def _export(self, argv):
        self._options = self._config.options

        plat = self._get_entity(argv)

        root_folder = plat.name
        if len(argv) > 2:
            root_folder = argv[2]

        export = Export(self._config.options.force)
        export.export_platform(plat, root_folder)
예제 #4
0
    def _export(self, argv):
        self._options = self._config.options

        plat = self._get_entity(argv)

        root_folder = plat.name
        if len(argv) > 2:
            root_folder = argv[2]

        export = Export(self._config.options.force)
        export.export_platform(plat, root_folder)
예제 #5
0
    def _export(self, argv):
        self._options = self._config.options

        app = self._get_entity(argv)

        root_folder = app.name
        if len(argv) > 2:
            root_folder = argv[2]

        export = Export(self._config.options.force)
        export.export_application(app, root_folder)
예제 #6
0
    def _export(self, argv):
        self._options = globals.options

        app = self._get_entity(argv)

        root_folder = app.name
        if len(argv) > 2:
            root_folder = argv[2]

        export = Export(globals.options.force)
        export.export_application(app, root_folder)
예제 #7
0
    def _export(self, argv):
        self._options = globals.options

        dist = self._get_entity(argv)

        root_folder = dist.name
        if len(argv) > 2:
            root_folder = argv[2]

        export = Export(globals.options.force)
        export.export_distribution(dist, root_folder)
예제 #8
0
    def _export(self, argv):
        self._options = globals.options

        dist = self._get_entity(argv)

        root_folder = dist.name
        if len(argv) > 2:
            root_folder = argv[2]

        export = Export(globals.options.force)
        export.export_distribution(dist, root_folder)
예제 #9
0
    def _import_entity_with_files_and_parameters(
            self,
            res_local,
            res_remote,
            root_folder,
            entity_type="entity",
            skip_conflict_detection=False):
        files_to_upload = res_local.files_f
        params_to_upload = res_local.parameters_f

        if self._update_existing and res_remote is not None:
            try:
                user = getpass.getuser()
            except:
                user = "******"
                pass

            export = Export(True)
            if entity_type == "application":
                export.export_application(res_remote,
                                          "/tmp/" + user + "/comodit-client/" +
                                          res_remote.name,
                                          backup=True)
            elif entity_type == "distribution":
                export.export_distribution(
                    res_remote,
                    "/tmp/" + user + "/comodit-client/" + res_remote.name,
                    backup=True)
            elif entity_type == "platform":
                export.export_platform(res_remote,
                                       "/tmp/" + user + "/comodit-client/" +
                                       res_remote.name,
                                       backup=True)

            self._delete_old_files(res_remote, files_to_upload, entity_type)
            self._delete_old_params(res_remote, params_to_upload, entity_type)

        conflict = self._detect_conflict(res_local, skip_conflict_detection)
        if conflict:
            for res_file in res_local.files_f:
                self._import_entity_and_detect_conflict(
                    res_file, "file", skip_conflict_detection)
            for param in res_local.parameters_f:
                self._import_entity_and_detect_conflict(
                    param, "parameter", skip_conflict_detection)

        self._import_entity(res_local, conflict, entity_type)

        # Push files' content
        for f in files_to_upload:
            file_name = f.name
            content_file = os.path.join(root_folder, "files", file_name)
            self._import_file_content(conflict, content_file, res_local,
                                      file_name, entity_type)

        if os.path.exists(os.path.join(root_folder, "thumb")):
            thumb_file = os.path.join(root_folder, "thumb")
            self._import_thumbnail(conflict, thumb_file, res_local,
                                   entity_type)
예제 #10
0
    def export(self, opts):
        if opts.path is None:
            raise Exception("You must provide the path to the output folder")

        export = Export(opts.force)
        export.export_platform(self._entity, opts.path)
예제 #11
0
    def export(self, opts):
        if opts.path is None:
            raise Exception("You must provide the path to the output folder")

        export = Export(opts.force)
        export.export_platform(self._entity, opts.path)