Skip to content

Commit

Permalink
Fix(cv_tag_v3): Long workspace name to avoid conflict (#679)
Browse files Browse the repository at this point in the history
* Fix(cv_tag_v3): Long workspace name to avoid conflict

* pep8 fix

* fix pylint error

* FIX(cv_tag_v3): Format datetime with padding 0

---------

Co-authored-by: RYAN CHETCUTI <[email protected]>
  • Loading branch information
sugetha24 and chetryan authored Nov 8, 2023
1 parent 3a1367d commit d319577
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
gather_facts: no
vars:
DEVICE1: s1-leaf3

DEVICE2: s1-leaf4

ASSIGN_DELETE_TAGS_AUTO_CREATE:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
gather_facts: no
vars:
DEVICE1: s1-leaf3

DEVICE2: s1-leaf4

ASSIGN_DELETE_TAGS_AUTO_CREATE:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,13 @@
import logging
import random
import string
from datetime import datetime
from ansible.module_utils.basic import AnsibleModule
import ansible_collections.arista.cvp.plugins.module_utils.logger # noqa # pylint: disable=unused-import
from ansible_collections.arista.cvp.plugins.module_utils.response import CvApiResult, CvManagerResult, CvAnsibleResponse
from ansible_collections.arista.cvp.plugins.module_utils.resources.schemas import v3 as schema
from ansible_collections.arista.cvp.plugins.module_utils.tools_schema import validate_json_schema
try:
from cvprac.cvp_client import CvpClient # noqa # pylint: disable=unused-import
from cvprac.cvp_client_errors import CvpApiError, CvpRequestError # noqa # pylint: disable=unused-import
from cvprac.cvp_client_errors import CvpRequestError
HAS_CVPRAC = True
except ImportError:
HAS_CVPRAC = False
Expand Down Expand Up @@ -110,7 +109,9 @@ def tasker(self, tags: list, mode: string, auto_create: bool = True):
tag_manager = CvManagerResult(builder_name='tags_manager')

# create workspace
workspace_name_id = "AnsibleWorkspace" + ''.join(random.choices(string.ascii_uppercase + string.digits, k=3))
my_date = datetime.now()
datetime_string = my_date.strftime('%Y%m%d_%H%M%S')
workspace_name_id = "AW_" + ''.join(random.choices(string.ascii_uppercase + string.digits, k=6)) + datetime_string
workspace_id = workspace_name_id

workspace_name = workspace_name_id
Expand Down

0 comments on commit d319577

Please sign in to comment.