Skip to content

Commit

Permalink
fix(deployment): inspect deployment with guid
Browse files Browse the repository at this point in the history
This commit fixes the rio deployment inspect command to work with deployment guids.

Azure Ticket:https://dev.azure.com/rapyuta-robotics/platform/_workitems/edit/16472
  • Loading branch information
YaswanthKumar-eng authored and pallabpain committed Sep 8, 2024
1 parent 5ce15f1 commit ffdd1f0
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion riocli/deployment/inspect.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
import re

import click
from click_help_colors import HelpColorsCommand
from munch import unmunchify
Expand All @@ -19,6 +21,8 @@
from riocli.constants import Colors
from riocli.utils import inspect_with_format

DEPLOYMENT_GUID_PATTERN = r'(^dep-[a-z0-9]+$|^inst-[a-z0-9]+$)'


@click.command(
'inspect',
Expand All @@ -38,7 +42,14 @@ def inspect_deployment(
"""
try:
client = new_v2_client()
deployment_obj = client.get_deployment(deployment_name)
deployment_obj = None

if re.fullmatch(DEPLOYMENT_GUID_PATTERN, deployment_name):
deployments = client.list_deployments(query={'guids': [deployment_name]})
if deployments:
deployment_obj = deployments[0]
else:
deployment_obj = client.get_deployment(deployment_name)

if not deployment_obj:
click.secho("deployment not found", fg='red')
Expand Down

0 comments on commit ffdd1f0

Please sign in to comment.