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

Updated Python SDK version and added property management commands #53

Merged
merged 10 commits into from
Nov 29, 2017
2 changes: 1 addition & 1 deletion src/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ def read(fname):
'knack==0.1.1',
'msrest>=0.4.4',
'requests',
'azure-servicefabric==6.0',
'azure-servicefabric==6.0.2',
Copy link
Collaborator

Choose a reason for hiding this comment

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

CI is not passing

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've ran the travis script locally in a virtualenv and can repeat the failure. pip install adal will resolve the issue - do you want me to add 'adal' to the requirements.txt or should we fix 6.0.2 dependency graph to ensure the package is pulled in?

Copy link
Collaborator

Choose a reason for hiding this comment

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

If it's a dependency of version 6.0.2 of azure-servicefabric then the requirements for the package must be updated. I don't think your changes here require adal explicitly.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It seems that between version 6.0.0 and 6.0.1 of azure-servicefabric that the msrestazure module is not being pulled in (although it still remains referenced in the requirements.txt) and therefore adal (which is a dependency of msrestazure) is not pulled in either. There is an explicit reference to 'adal' in src/sfctl/auth.py therefore I think it makes sense to put it in sfctl's requirements.txt rather than rely on an external package's dependency - I'm no expert in python dependencies so happy to take your advice on this.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Yeah it's fine to add it as a dependency for sfctl. I must have missed that whoever authored the auth changes didn't add that package.

'jsonpickle'
],
extras_require={
Expand Down
6 changes: 6 additions & 0 deletions src/sfctl/commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,12 @@ def load_command_table(self, args): #pylint: disable=too-many-statements
group.command('command', 'invoke_infrastructure_command')
Copy link
Collaborator

Choose a reason for hiding this comment

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

Add help text for the property group now

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Is an additional help file required for a standard command group?

Copy link
Collaborator

Choose a reason for hiding this comment

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

You added a group of commands: sfctl property. In the same way there's documentation on sfctl application. Take a look at how the help is defined for that group.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ok will do, thanks.

group.command('query', 'invoke_infrastructure_query')

with super_group.group('property') as group:
Copy link
Collaborator

Choose a reason for hiding this comment

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

You should add scenario tests for this, take a look at the existing tests to see how to write scenario tests and the wiki documentation

Copy link
Contributor Author

@jjcollinge jjcollinge Nov 17, 2017

Choose a reason for hiding this comment

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

I had a look at writing some scenario tests - the only Service Fabric name that I can guarantee is in the cluster is the 'System' name. I can test the 'list' and 'get' against it but it's restricted as far as 'put' and 'delete'.
I can either deploy an application using the 'sfctl application' commands or update this PR to include a new property group for 'name' (i.e. sfctl name create "{"Name":"TestName"}") and couple the property tests to the name commands. How do you suggest I proceed? Docs on this API are here: https://docs.microsoft.com/en-us/rest/api/servicefabric/sfclient-index-property-management

group.command('put', 'put_property')
group.command('list', 'get_property_info_list')
group.command('get', 'get_property_info')
group.command('delete', 'delete_property')

# Custom commands

with CommandSuperGroup(__name__, self,
Expand Down
3 changes: 3 additions & 0 deletions src/sfctl/params.py
Original file line number Diff line number Diff line change
Expand Up @@ -152,3 +152,6 @@ def custom_arguments(self, _): #pylint: disable=too-many-statements
arg_context.argument('unhealthy_app', type=int)
arg_context.argument('default_svc_type_health_map', type=json_encoded)
arg_context.argument('svc_type_health_map', type=json_encoded)

with ArgumentsContext(self, 'property put') as arg_context:
arg_context.argument('property_description', type=json_encoded)