1414# See the License for the specific language governing permissions and
1515# limitations under the License.
1616
17- # set the service account key as a GOOGLE_APPLICATION_CREDENTIALS
18- export GOOGLE_APPLICATION_CREDENTIALS=~ /key.json
17+ {
18+ # set the service account key as a GOOGLE_APPLICATION_CREDENTIALS
19+ export GOOGLE_APPLICATION_CREDENTIALS=~ /key.json
1920
20- # activate the python virtual env
21- source ~ /cloudshell_open/myenv/bin/activate
21+ # activate the python virtual env
22+ source ~ /cloudshell_open/myenv/bin/activate
2223
23- # Create a GCS bucket and upload the product data to the bucket
24- output=$( python ~ /cloudshell_open/python-retail/samples/interactive-tutorials/product/setup_product/products_create_gcs_bucket.py)
24+ # Create a GCS bucket and upload the product data to the bucket
25+ output=$( python ~ /cloudshell_open/python-retail/samples/interactive-tutorials/product/setup_product/products_create_gcs_bucket.py)
2526
26- # Get the bucket name and store it in the env variable BUCKET_NAME
27- temp=" ${output#* The gcs bucket } "
28- bucket_name=" ${temp% was created* } "
29- export BUCKET_NAME=$bucket_name
27+ # Get the bucket name and store it in the env variable BUCKET_NAME
28+ temp=" ${output#* The gcs bucket } "
29+ bucket_name=" ${temp% was created* } "
30+ export BUCKET_NAME=$bucket_name
3031
31- # Import products to the Retail catalog
32- python ~ /cloudshell_open/python-retail/samples/interactive-tutorials/product/import_products_gcs.py
33-
34- echo " ====================================="
35- echo " Your Retail catalog is ready to use!"
36- echo " ====================================="
32+ # Import products to the Retail catalog
33+ python ~ /cloudshell_open/python-retail/samples/interactive-tutorials/product/import_products_gcs.py
34+ } && {
35+ # Print success message
36+ echo " ====================================="
37+ echo " Your Retail catalog is ready to use!"
38+ echo " ====================================="
39+ } || {
40+ # Print error message
41+ echo " ====================================="
42+ echo " Your Retail catalog wasn't created! Please fix the errors above!"
43+ echo " ====================================="
44+ }
0 commit comments