-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Allow vendoring into nnf-integration-test repo
Adjust vendor-new-api.py so it can vendor into the nnf-integration-test repo. This relies on a new crd-bumper.yaml file in that repo to give some hints. Refactor code that checks whether an API is a hub or a spoke. Refactor code that references the crd-bumper.yaml file. This simplifies the use of the object that holds the content of that file. Reformat code with 'black'. Signed-off-by: Dean Roehrich <[email protected]>
- Loading branch information
1 parent
afa9f7b
commit c50a5fa
Showing
7 changed files
with
117 additions
and
44 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
# Copyright 2024 Hewlett Packard Enterprise Development LP | ||
# Other additional copyright holders may be indicated within. | ||
# | ||
# The entirety of this work is licensed under the Apache License, | ||
# Version 2.0 (the "License"); you may not use this file except | ||
# in compliance with the License. | ||
# | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# 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 os | ||
|
||
from .fileutil import FileUtil | ||
|
||
|
||
class HubSpokeUtil: | ||
"""Simple utilities related to hub and spokes.""" | ||
|
||
@staticmethod | ||
def is_spoke(ver): | ||
""" | ||
Determine whether or not the 'ver' API is a spoke. | ||
""" | ||
path = f"api/{ver}/conversion.go" | ||
if not os.path.isfile(path): | ||
return False | ||
fu = FileUtil(False, path) | ||
line = fu.find_in_file(" ConvertTo(dstRaw conversion.Hub) ") | ||
if line is None: | ||
return False | ||
return True | ||
|
||
@staticmethod | ||
def is_hub(ver): | ||
""" | ||
Determine whether or not the 'ver' API is a hub. | ||
""" | ||
path = f"api/{ver}/conversion.go" | ||
if not os.path.isfile(path): | ||
return False | ||
fu = FileUtil(False, path) | ||
line = fu.find_in_file(" Hub() ") | ||
if line is None: | ||
return False | ||
return True |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters