Skip to content

Commit

Permalink
Merge branch 'master' into maxmof-827
Browse files Browse the repository at this point in the history
  • Loading branch information
unnati-solanki-git authored Nov 22, 2024
2 parents c0e9d23 + 73aa5c1 commit d16abe1
Show file tree
Hide file tree
Showing 27 changed files with 330 additions and 282 deletions.
13 changes: 10 additions & 3 deletions .github/workflows/verify-cli-pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,20 @@ on:
jobs:
build:
runs-on: ubuntu-latest
if: '! github.event.pull_request.draft'
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v4

- name: Fail if local Ansible collection is present in PR to master
- name: Fail if local build of Ansible collection or Python package are present in a PR to master branch
run: |
RC=0
if [[ -e $GITHUB_WORKSPACE/image/cli/install/ibm-mas_devops.tar.gz ]]; then
echo "Found a local Ansible collection($GITHUB_WORKSPACE/image/cli/install/ibm-mas_devops.tar.gz) in this PR, Local ansible collection is not allowed in master branch. Failing build."
exit 1
echo "Found local Ansible collection($GITHUB_WORKSPACE/image/cli/install/ibm-mas_devops.tar.gz) in this PR, Local collection is not allowed in the master branch."
RC=1
fi
if [[ -e $GITHUB_WORKSPACE/image/cli/install/mas_devops.tar.gz ]]; then
echo "Found local Python package ($GITHUB_WORKSPACE/image/cli/install/mas_devops.tar.gz) in this PR, Local package is not allowed in the master branch."
RC=1
fi
exit $RC
3 changes: 2 additions & 1 deletion image/cli/app-root/src/run-role.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@ source /opt/app-root/src/env.sh
python3 /opt/app-root/src/register-start.py

export ROLE_NAME=$1
ansible-playbook ibm.mas_devops.run_role
shift
ansible-playbook ibm.mas_devops.run_role $@
rc=$?
python3 /opt/app-root/src/save-junit-to-mongo.py
exit $rc
12 changes: 6 additions & 6 deletions python/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,12 +58,12 @@ def get_version(rel_path):
description='Python Admin CLI for Maximo Application Suite',
long_description=long_description,
install_requires=[
'mas-devops >= 1.7.1', # EPL
'halo', # MIT License
'prompt_toolkit', # BSD License
'openshift', # Apache Software License
'kubernetes', # Apache Software License
'tabulate' # MIT License
'mas-devops >= 1.10.0', # EPL
'halo', # MIT License
'prompt_toolkit', # BSD License
'openshift', # Apache Software License
'kubernetes', # Apache Software License
'tabulate' # MIT License
],
extras_require={
'dev': [
Expand Down
7 changes: 4 additions & 3 deletions python/src/mas/cli/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
from openshift.dynamic import DynamicClient
from openshift.dynamic.exceptions import NotFoundError

from prompt_toolkit import prompt, print_formatted_text, HTML
from prompt_toolkit import prompt, print_formatted_text, HTML, PromptSession

from mas.devops.mas import isAirgapInstall
from mas.devops.ocp import connect, isSNO, getNodes
Expand Down Expand Up @@ -173,6 +173,7 @@ def __init__(self):
"visualinspection": ["8.8.x", "8.7.x"]
}
}
self.promptSession = PromptSession()

self.spinner = {
"interval": 80,
Expand All @@ -184,9 +185,9 @@ def __init__(self):
self._dynClient = None

self.printTitle(f"\nIBM Maximo Application Suite Admin CLI v{self.version}")
print_formatted_text(HTML("Powered by <DarkGoldenRod><u>https://github.com/ibm-mas/ansible-devops/</u></DarkGoldenRod> and <DarkGoldenRod><u>https://tekton.dev/</u></DarkGoldenRod>\n"))
print_formatted_text(HTML("Powered by <Orange><u>https://github.com/ibm-mas/ansible-devops/</u></Orange> and <Orange><u>https://tekton.dev/</u></Orange>\n"))
if which("kubectl") is None:
self.fatalError("Could not find kubectl on the path, see <DarkGoldenRod><u>https://kubernetes.io/docs/tasks/tools/#kubectl</u></DarkGoldenRod> for installation instructions")
self.fatalError("Could not find kubectl on the path, see <Orange><u>https://kubernetes.io/docs/tasks/tools/#kubectl</u></Orange> for installation instructions")

@logMethodCall
def createTektonFileWithDigest(self) -> None:
Expand Down
6 changes: 5 additions & 1 deletion python/src/mas/cli/displayMixins.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,11 @@ def promptForString(self, message: str, param: str = None, default: str = "", is
if param is not None and default == "":
default = getenv(param.upper(), default="")

response = prompt(masPromptValue(message), is_password=isPassword, default=default, completer=completer, validator=validator, validate_while_typing=False)
if completer is not None:
response = self.promptSession.prompt(masPromptValue(message), is_password=isPassword, default=default, completer=completer, validator=validator, validate_while_typing=False, pre_run=self.promptSession.default_buffer.start_completion)
else:
response = self.promptSession.prompt(masPromptValue(message), is_password=isPassword, default=default, completer=completer, validator=validator, validate_while_typing=False)

if param is not None:
self.params[param] = response
return response
Expand Down
Loading

0 comments on commit d16abe1

Please sign in to comment.