Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WIP] - Add OpenShift support #7385

Closed
wants to merge 21 commits into from
Closed

[WIP] - Add OpenShift support #7385

wants to merge 21 commits into from

Conversation

julienstroheker
Copy link
Contributor

Please do not merge WIP

Related to :


This checklist is used to make sure that common guidelines for a pull request are followed.

  • The PR has modified HISTORY.rst describing any customer-facing, functional changes. Note that this does not include changes only to help content. (see Modifying change log).

  • I adhere to the Command Guidelines.

Copy link
Contributor

@troydai troydai left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Still reviewing it. One comment for now.

from .exceptions import CliTestError
from .checkers import (JMESPathCheck, JMESPathCheckExists, JMESPathCheckGreaterThan, NoneCheck, StringCheck,
StringContainCheck)
from .decorators import api_version_constraint
from .utilities import create_random_name

__all__ = ['ScenarioTest', 'LiveScenarioTest', 'ResourceGroupPreparer', 'StorageAccountPreparer',
'RoleBasedServicePrincipalPreparer', 'CliTestError', 'JMESPathCheck', 'JMESPathCheckExists', 'NoneCheck',
'RoleBasedServicePrincipalPreparer', 'ManagedApplicationPreparer', 'CliTestError', 'JMESPathCheck', 'JMESPathCheckExists', 'NoneCheck',
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Break the line at 120.

self.test_class_instance.kwargs[self.key] = name
# The slice is the easiest way for know to return the Teanant from the same command
return {self.parameter_name: self.result['appId'], self.parameter_secret: name,
self.parameter_tenant: self.result['odata.metadata'][26:62]}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This not very stable. Isn't there any alternative?

Copy link
Contributor Author

@julienstroheker julienstroheker Sep 24, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Indeed, it is not very clean, the response from the command is not returning this field tenantID this is why I did this, to test.

I can add another cli command such as az account list to get this info though ?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sounds like a more stable solution than this. Please do that and also add comments regarding why it invokes that command to fetch the tenant id.

Add _ensure_osa_aad
# Conflicts:
#	src/command_modules/azure-cli-acs/HISTORY.rst
#	src/command_modules/azure-cli-acs/setup.py
aad_tenant_id=None,
identifier=None,
name=None):
# TODO: This really needs to be unit tested.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add the unit tests.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry I forgot to remove that comment, Can you tell me if my tests in test_osa_commands.py are ok ?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i think so.

@@ -2199,3 +2243,109 @@ def _validate_aci_location(norm_location):
if norm_location not in aci_locations:
raise CLIError('Azure Container Instance is not available at location "{}".'.format(norm_location) +
' The available locations are "{}"'.format(','.join(aci_locations)))


def openshift_create(cmd, client, resource_group_name, name, # pylint: disable=too-many-locals
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Break this method into smaller methods to avoid too-many-locals warning.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am not sure to understand how I can do this. Those parameters are from the user. I am doing the same logic as the aks_create fct around line 1415. Can you give me some hints here ?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"too many locals" means that you defined too many local variables in this method, which indicates that the body of the function is too large.


# We don't creating the AADIdentity for the user right now but maybe later so keeping this
# Keeping this Due to SPN replication latency, we do a few retries here
max_retry = 30
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will make the retry last up to 90 seconds. I recommend you print warning to the stderr through logging so as to avoid the impression of command hanging.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I removed that part since I added the auto creation of the AADIdentity : _ensure_osa_aad

ResourceGroupPreparer, ManagedApplicationPreparer, ScenarioTest, live_only)
from azure_devtools.scenario_tests import AllowLargeResponse
from azure.cli.testsdk.checkers import (
StringContainCheck, StringContainCheckIgnoreCase)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Keep in the line.

Add _remove_nulls_osa
Update NetworkProfile
Rename Models
Rename node-count to compute-count
fqdn mandatory
@troydai troydai requested a review from williexu October 16, 2018 01:50
@troydai
Copy link
Contributor

troydai commented Oct 25, 2018

Please remove me from the reviewers list.

self.result = {}
self.app_name = app_name
self.dev_setting_app_name = os.environ.get(dev_setting_app_name, None)
self.dev_setting_app_secret = os.environ.get(dev_setting_app_secret, None)
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Isn't the default value for os.environ.get already None?

@tjprescott tjprescott added do-not-merge ACS az acs/aks/openshift New Command(s) and removed ACS az acs/aks/openshift labels Oct 29, 2018
@tjprescott tjprescott added the closing soon Issues/PRs flagged to be closed soon due to inactivty, inapplicability, etc. label Dec 11, 2018
@tjprescott
Copy link
Member

Closing due to inactivity. Feel free to reopen when the PR is ready.

@tjprescott tjprescott closed this Dec 13, 2018
@julienstroheker
Copy link
Contributor Author

Hi @tjprescott waiting after : Azure/azure-sdk-for-python#3378 to be merged

@tjprescott
Copy link
Member

Hi @julienstroheker no worries. Feel free to reopen when the Python SDK is merged.

@haroldrandom haroldrandom added closing soon Issues/PRs flagged to be closed soon due to inactivty, inapplicability, etc. do-not-merge New Command(s) labels Oct 25, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
closing soon Issues/PRs flagged to be closed soon due to inactivty, inapplicability, etc. do-not-merge New Command(s)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants