Repository: PrefectHQ/prefect

Issue:
Unable to deploy a flow with version 2.10.6
### First check

- [X] I added a descriptive title to this issue.
- [X] I used the GitHub search to find a similar issue and didn't find it.
- [X] I searched the Prefect documentation for this issue.
- [X] I checked that this issue is related to Prefect and not one of its dependencies.

### Bug summary

I'm trying to deploy a flow and facing this error:

`'NoneType' object has no attribute 'get'`

This is happening with the last update (2.10.6)

I can run the flow through python3 flow.py as you can see below:
![image](https://user-images.githubusercontent.com/27255269/235213247-708ecbd5-890b-4019-9e7f-90aa038ab651.png)

Downgrading the version I'm able to do normally.



### Reproduction

```python3
prefect deploy alocacao/alocacao_predictions.py:main_pred -n alocacao-pred-deploy -p alocacao-work
```


### Error

```python3
'NoneType' object has no attribute 'get'
```


### Versions

```Text
Version:             2.10.6
API version:         0.8.4
Python version:      3.11.3
Git commit:          d7a8f6bf
Built:               Thu, Apr 27, 2023 2:23 PM
OS/Arch:             darwin/arm64
Profile:             default
Server type:         server
```


### Additional context

_No response_


Discussion:
Thanks for opening an issue @RochaOwng! Can you share the contents of your `deployment.yaml` to help me reproduce this issue?
Hey @desertaxle!

My deployment.yaml is the default one. Didn't change anything

```
# base metadata
name: null
version: null
tags: []
description: null
schedule: null

# flow-specific fields
flow_name: null
entrypoint: null
path: null
parameters: {}
parameter_openapi_schema: null

# infra-specific fields
work_pool:
  name: null
  work_queue_name: null
  job_variables: {}
```
Thanks @RochaOwng! I was able to reproduce this issue and identify a fix. 

In the interim, you can remove the `schedule` key from your `deployment.yaml` file, or replace the `null` value with an empty object like so: `schedule: {}`. Once you've made one of those two changes, you should be able to run `prefect deploy` successfully.

Resolving patch:
diff --git a/src/prefect/cli/deploy.py b/src/prefect/cli/deploy.py
--- a/src/prefect/cli/deploy.py
+++ b/src/prefect/cli/deploy.py
@@ -243,7 +243,7 @@ async def deploy(
                     project=project,
                     options=options,
                 )
-    except Exception as exc:
+    except ValueError as exc:
         exit_with_error(str(exc))
 
 
@@ -256,7 +256,9 @@ async def _run_single_deploy(
 
     base_deploy = _merge_with_default_deployment(base_deploy)
 
-    base_deploy_schedule = base_deploy.get("schedule", {})
+    base_deploy_schedule = base_deploy.get("schedule")
+    if base_deploy_schedule is None:
+        base_deploy_schedule = {}
 
     name = options.get("name") or base_deploy.get("name")
     flow_name = options.get("flow_name") or base_deploy.get("flow_name")


Test patch:
diff --git a/tests/cli/test_deploy.py b/tests/cli/test_deploy.py
--- a/tests/cli/test_deploy.py
+++ b/tests/cli/test_deploy.py
@@ -51,6 +51,8 @@ def project_dir_with_single_deployment_format(tmp_path):
         with open("deployment.yaml", "r") as f:
             contents = yaml.safe_load(f)
 
+        contents["deployments"][0]["schedule"] = None
+
         with open("deployment.yaml", "w") as f:
             yaml.safe_dump(contents["deployments"][0], f)
 
@@ -64,6 +66,8 @@ def project_dir_with_single_deployment_format(tmp_path):
         with open("deployment.yaml", "r") as f:
             contents = yaml.safe_load(f)
 
+        contents["deployments"][0]["schedule"] = None
+
         with open("deployment.yaml", "w") as f:
             yaml.safe_dump(contents["deployments"][0], f)