def sync()

in source/cdk_solution_helper_py/helpers_cdk/aws_solutions/cdk/scripts/build_s3_cdk_dist.py [0:0]


    def sync(self):
        """Sync the assets packaged"""
        if not self.local_asset_path:
            raise ValueError("missing local asset path for sync")
        if not self.s3_asset_path:
            raise ValueError("missing s3 asset path for sync")

        self.check_bucket()
        try:
            with subprocess.Popen(
                [
                    "aws",
                    "s3",
                    "sync",
                    self.local_asset_path,
                    self.s3_asset_path,
                    "--no-progress",
                    "--acl",
                    "bucket-owner-full-control",
                ],
                shell=False,
                stdout=subprocess.PIPE,
                stderr=subprocess.PIPE,
                universal_newlines=True,
            ) as p:
                for line in p.stdout:
                    logger.info("s3 sync: %s" % line.strip())
                for line in p.stderr:
                    logger.error("s3 sync: %s" % line.strip())
        except FileNotFoundError:
            logger.error("awscli is missing")
            raise click.ClickException("--sync requires awscli to be installed")
        if p.returncode != 0:
            raise click.ClickException("--sync failed")