def quality_control(self, commercial_invoice, attach=False, clean=None, test=None, configs=None, use_cache=False, env=None):
        """
        :param attach:
        :param clean:
        :param test:
        :param configs:
        :return:
        """
        commercial_invoice = self.__validate_commercial_invoice(commercial_invoice, 'quality_control')

        fleet = self.__assemble_fleet(commercial_invoice)
        logger.info('Running quality control.')

        try:
            for address, container_ship in six.iteritems(fleet):
                # write state file
                self.__write_state_file(address, commercial_invoice.data_center, commercial_invoice.environment)

                # get new transport service
                transport_service = commercial_invoice.transport_service

                # if env is provided merge what has been passed.
                if env is not None:
                    transport_service.container_config.merge_env(env)

                # share some host info with user.
                container_ship.report()

                # check with dispatch to see if its okay to export.
                self.__wait_for_dispatch(address)

                logger.info('dispatching service: {0} on host: {1}.'.format(
                    transport_service.alias,
                    address
                ))

                # TODO: need to inject on all services during qc if configs == true
                if configs:
                    container_ship.injector = commercial_invoice.injector if configs else None

                if attach:
                    dependents = False
                else:
                    dependents = True

                self.__dispatch(container_ship, transport_service, attach, configs, dependents, test, use_cache)

                if clean:
                    # delete containers.
                    container_ship.offload_service_containers(transport_service)

                    # delete images
                    container_ship.offload_service_cargo(transport_service)
                else:
                    # clean up previous containers
                    container_ship.offload_previous_containers(transport_service)

                    # clean up service expired service cargo.
                    container_ship.offload_expired_service_cargo(transport_service)

            # TODO: Do something with failures / return bill of lading
            return False if self._bill_of_lading.get('failures') else True
        finally:
            # complete distribution and delete state file.
            self.__complete_distribution(commercial_invoice)
:param attach:
        :param clean:
        :param test:
        :param configs:
        :return: