GithubHelp home page GithubHelp logo

microsoft / service-fabric-cli Goto Github PK

View Code? Open in Web Editor NEW
52.0 39.0 54.0 3.01 MB

Service Fabric CLI Tools

License: Other

Shell 0.14% Python 99.73% Batchfile 0.13%
azure azure-service-fabric python

service-fabric-cli's Introduction

Service Fabric CLI (sfctl)

PyPi Version PyPI - Python Version License Coverage Status

Command-line interface for interacting with Azure Service Fabric clusters and their related entities.

Installation

pip install sfctl

Launching

sfctl <command>

For more information, specify the -h flag:

sfctl -h

Developer Help and Documentation

See the corresponding Wiki for more information.

Contributing

This project has adopted the Microsoft Open Source Code of Conduct. For more information, see the Code of Conduct FAQ or contact [email protected] with any additional questions or comments.

service-fabric-cli's People

Contributors

acukanovic-zz avatar belmaiastar avatar christina-kang avatar daviddob avatar dependabot[bot] avatar ibabou avatar ivan12346 avatar iyyappam avatar jeffj6123 avatar jiqh avatar jjcollinge avatar jkochhar avatar leikong avatar likevi-msft avatar maburlik avatar mattipv4 avatar microsoft-github-policy-service[bot] avatar microsoftopensource avatar motanv avatar mrdakj avatar msftgits avatar radicmilos avatar rapatchi avatar samedder avatar vshan avatar yu-supersonic avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

service-fabric-cli's Issues

Application provision fails with E_INVALIDARG fabric error

After running
sfctl application upload --path ~\Application\pkg\Debug --show-progress

The upload completes successfully, but then when running

sfctl application provision --no-wait --application-type-build-path Debug

I am getting this error

(E_INVALIDARG) Invalid argument
Traceback (most recent call last):
File "c:\users\venoss\appdata\local\programs\python\python36-32\lib\site-packa
ges\knack\cli.py", line 125, in invoke
cmd_result = self.invocation.execute(args)
File "c:\users\venoss\appdata\local\programs\python\python36-32\lib\site-packa
ges\knack\invocation.py", line 85, in execute
cmd_result = parsed_args.func(params)
File "c:\users\venoss\appdata\local\programs\python\python36-32\lib\site-packa
ges\knack\commands.py", line 67, in call
return self.handler(*args, **kwargs)
File "c:\users\venoss\appdata\local\programs\python\python36-32\lib\site-packa
ges\knack\commands.py", line 123, in _command_handler
result = op(client, **command_args) if client else op(**command_args)
File "c:\users\venoss\appdata\local\programs\python\python36-32\lib\site-packa
ges\sfctl\custom_app_type.py", line 119, in provision_application_type
raise FabricErrorException(client._deserialize, response)
azure.servicefabric.models.fabric_error.FabricErrorException: (E_INVALIDARG) Inv
alid argument

sfctl version 5.0.0

Support zipped application upload

Currently there's a hard coded check to only allow directory uploads. The image store now supports uploading zipped application packages. In order to speed up application uploads, consider using zipped uploads.

`application upload` returns 400 despite success

When running an application upload command, sometimes the return status for a single file upload will be a 400 error, despite the file upload completing without issue.

This is due to behaviour from the Service Fabric cluster and not the CLI.

New naming convention results in errors

Whenever trying to pass an application or service id using the new convention of delimiting name sections with ~, the operation fails with FABRIC_E_INVALID_NAME_URI.

For example sfctl application info --application-id TestEd~Test fails.

As a workaround however sfctl application info --application-id TestEd/Test does work

Deleting a non existent application returns an invalid status code

When deleting an application that does not exist the response code appears to be invalid:

Operation returned an invalid status code 'Not Found'
Traceback (most recent call last):
  File "/home/imang/.local/lib/python3.5/site-packages/knack/cli.py", line 125, in invoke
    cmd_result = self.invocation.execute(args)
  File "/home/imang/.local/lib/python3.5/site-packages/knack/invocation.py", line 85, in execute
    cmd_result = parsed_args.func(params)
  File "/home/imang/.local/lib/python3.5/site-packages/knack/commands.py", line 67, in __call__
    return self.handler(*args, **kwargs)
  File "/home/imang/.local/lib/python3.5/site-packages/knack/commands.py", line 123, in _command_handler
    result = op(client, **command_args) if client else op(**command_args)
  File "/home/imang/.local/lib/python3.5/site-packages/azure/servicefabric/service_fabric_client_ap_is.py", line 3128, in delete_application
    raise models.FabricErrorException(self._deserialize, response)
azure.servicefabric.models.fabric_error.FabricErrorException: Operation returned an invalid status code 'Not Found'

The API does not expect to return a 404 status code.

Linux - sfctl compose - allow private container registry password

I need to run Linux containers using images stored in a private registry. Also, I want to deploy them automatically, after every version upgrade.
For this, I need to be allowed to pass credentials to sfctl compose. There are two documented ways to provide the registry password:

interactive - I can't use this, because a daemon is deploying
encrypted - I can't use this, because I can't encrypt settings data on Linux (?) (only found PowerShell cmd to encrypt)
Repro:

Create docker-compose.yaml
Push images to private registry
Create deployment pipeline, not using VSTS but Jenkins on Linux.
Run script:
sfctl compose create --deployment-name MyApp --file-path /var/lib/jenkins/workspace/ServiceFabricJob/docker-compose-asf.yml
Issue:

The behavior now is to access the registry without credentials, which fails.

sfctl service update --load-metrics json argument format

The doc states

--load-metrics JSON encoded list of metrics used when load balancing services across nodes.

I looked in the tests to maybe find an example, but they use the python method directly so, it does not give a CLI example :

https://github.com/Azure/service-fabric-cli/blob/89265b7c19f503956f9a23490352086c38cf226f/src/sfctl/tests/service_test.py#L44

And following this example using --parameters passing json to the sfctl cli, I tried :

sfctl service update --service-id ServiceManifestChanges/StatefulSvc --load-metrics "[{\"name\":
\"Test\", \"default_primary_load\":100, \"default_secondary_load\"}]" --stateful

But I also tried :

sfctl service update --service-id ServiceManifestChanges/StatefulSvc --stateful  --load-metrics "[{'name':
'Test', 'default_primary_load':100, 'default_secondary_load':100}]" 

sfctl service update --service-id ServiceManifestChanges/StatefulSvc --stateful --load-metrics "[{name:
Test, default_primary_load:100, default_secondary_load:100}]"

They all fail with the same unhelpful error message :

'str' object has no attribute 'get'
Traceback (most recent call last):
  File "/usr/local/lib/python2.7/dist-packages/knack/cli.py", line 125, in invoke
    cmd_result = self.invocation.execute(args)
  File "/usr/local/lib/python2.7/dist-packages/knack/invocation.py", line 85, in execute
    cmd_result = parsed_args.func(params)
  File "/usr/local/lib/python2.7/dist-packages/knack/commands.py", line 67, in __call__
    return self.handler(*args, **kwargs)
  File "/usr/local/lib/python2.7/dist-packages/knack/commands.py", line 123, in _command_handler
    result = op(client, **command_args) if client else op(**command_args)
  File "/usr/local/lib/python2.7/dist-packages/sfctl/custom_service.py", line 438, in update
    metric_desc = parse_load_metrics(load_metrics)
  File "/usr/local/lib/python2.7/dist-packages/sfctl/custom_service.py", line 36, in parse_load_metrics
    l_name = l.get('name', None)
AttributeError: 'str' object has no attribute 'get'

So, it cannot parse the parameter. what is the expected format ?

Value error when attempting to run from VS

Running sfctl after installing the CLI through a Python install in VS results in a Value Error

  • sfctl version 3.0.0

File "c:\program files (x86)\microsoft visual studio\shared\python36_64\lib\runpy.py", line 193, in run_module_as_main
"main", mod_spec)
File "c:\program files (x86)\microsoft visual studio\shared\python36_64\lib\runpy.py", line 85, in run_code
exec(code, run_globals)
File "C:\Program Files (x86)\Microsoft Visual Studio\Shared\Python36_64\Scripts\sfctl.exe_main
.py", line 5, in
File "c:\program files (x86)\microsoft visual studio\shared\python36_64\lib\site-packages\sfctl_init
.py", line 16, in
from sfctl.entry import launch
File "c:\program files (x86)\microsoft visual studio\shared\python36_64\lib\site-packages\sfctl\entry.py", line 13, in
from knack import CLI
File "c:\program files (x86)\microsoft visual studio\shared\python36_64\lib\site-packages\knack_init_.py", line 6, in
from .cli import CLI
ValueError: source code string cannot contain null bytes

Error Installing Example Service

After setting up Linux development environment for Service Fabric, .NET Core and sfctl.

I build an Azure Sample of a Service Fabric service and run the install script from here:
https://github.com/Azure-Samples/service-fabric-dotnet-core-getting-started/blob/master/Services/CounterService/install.sh

And I get the following error:
image

Which points to this line in your code:
https://github.com/Azure/service-fabric-cli/blob/6ec1b1c8445b7cc5a889f3b172b47a6017c8888c/src/sfctl/custom_app.py#L100

Please advise, I'd like to get this example working.

What is an example command for displaying the logs of my application/container?

I'm new. I have deployed a silly public docker image that just prints to STDOUT every second. I'm trying to figure out how to see my SF container's logs. My searching of docs etc has failed me so I thought I'd create an issue - and perhaps I can take your answer and help write docs.

I think I understand --node-name (e.g. _Node_1) and --application-id (sfctl application info --application-id Lattice works), and --service-manifest-name (is it the <Service Name="LatticeService"> from ApplicationManifest.xml?) but am unsure about --code-package-name.

e.g. how close am I?

sfctl service get-container-logs --node-name _Node_1 --application-id Lattice --service-manifest-name LatticeService --code-package-name ???

This errors with:

azure.servicefabric.models.fabric_error.FabricErrorException: (FABRIC_E_CONTAINER_NOT_FOUND) Container not found.
  • sfctl version, can check this using pip show sfctl
    Version: 4.0.0
  • Service Fabric cluster runtime version
    OSS servicefabric_6.2.141.1.deb
  • Service Fabric hosting location (on-premise or Azure usually)
    Self-hosted on AWS Ubuntu 16.04

Help option results in exception on sfctl property put

Using sfctl version 4.0.0, setting the -h option on the sfctl property put command results in an error.

Expected

usage: sfctl property put [-h] [--verbose] [--debug]
                          [--output {json,jsonc,table,tsv}] [--query JMESPATH]
                          --name-id NAME_ID --property-name PROPERTY_NAME
                          --value VALUE [--custom-id-type CUSTOM_ID_TYPE]
                          [-t TIMEOUT]
sfctl property put: error: the following arguments are required: --name-id, --property-name, --value

Actual

C:\>sfctl property put -h
mapping values are not allowed here
  in "<unicode string>", line 17, column 30:
                and can be values: 'Binary', 'Int64', 'Double', ' ...
                                 ^
Traceback (most recent call last):
  File "c:\python\python36\lib\site-packages\knack\cli.py", line 125, in invoke
    cmd_result = self.invocation.execute(args)
  File "c:\python\python36\lib\site-packages\knack\invocation.py", line 78, in execute
    parsed_args = self.parser.parse_args(args)
  File "c:\python\python36\lib\argparse.py", line 1730, in parse_args
    args, argv = self.parse_known_args(args, namespace)
  File "c:\python\python36\lib\argparse.py", line 1762, in parse_known_args
    namespace, args = self._parse_known_args(args, namespace)
  File "c:\python\python36\lib\argparse.py", line 1950, in _parse_known_args
    positionals_end_index = consume_positionals(start_index)
  File "c:\python\python36\lib\argparse.py", line 1927, in consume_positionals
    take_action(action, args)
  File "c:\python\python36\lib\argparse.py", line 1836, in take_action
    action(self, namespace, argument_values, option_string)
  File "c:\python\python36\lib\argparse.py", line 1133, in __call__
    subnamespace, arg_strings = parser.parse_known_args(arg_strings, None)
  File "c:\python\python36\lib\argparse.py", line 1762, in parse_known_args
    namespace, args = self._parse_known_args(args, namespace)
  File "c:\python\python36\lib\argparse.py", line 1950, in _parse_known_args
    positionals_end_index = consume_positionals(start_index)
  File "c:\python\python36\lib\argparse.py", line 1927, in consume_positionals
    take_action(action, args)
  File "c:\python\python36\lib\argparse.py", line 1836, in take_action
    action(self, namespace, argument_values, option_string)
  File "c:\python\python36\lib\argparse.py", line 1133, in __call__
    subnamespace, arg_strings = parser.parse_known_args(arg_strings, None)
  File "c:\python\python36\lib\argparse.py", line 1762, in parse_known_args
    namespace, args = self._parse_known_args(args, namespace)
  File "c:\python\python36\lib\argparse.py", line 1968, in _parse_known_args
    start_index = consume_optional(start_index)
  File "c:\python\python36\lib\argparse.py", line 1908, in consume_optional
    take_action(action, args, option_string)
  File "c:\python\python36\lib\argparse.py", line 1836, in take_action
    action(self, namespace, argument_values, option_string)
  File "c:\python\python36\lib\argparse.py", line 1020, in __call__
    parser.print_help()
  File "c:\python\python36\lib\argparse.py", line 2362, in print_help
    self._print_message(self.format_help(), file)
  File "c:\python\python36\lib\site-packages\knack\parser.py", line 132, in format_help
    is_group)
  File "c:\python\python36\lib\site-packages\knack\help.py", line 22, in show_help
    help_file.load(parser)
  File "c:\python\python36\lib\site-packages\knack\help.py", line 296, in load
    self._load_from_file()
  File "c:\python\python36\lib\site-packages\knack\help.py", line 299, in _load_from_file
    file_data = _load_help_file(self.delimiters)
  File "c:\python\python36\lib\site-packages\knack\help_files.py", line 14, in _load_help_file
    return yaml.load(helps[delimiters])
  File "C:\Users\mcollier\AppData\Roaming\Python\Python36\site-packages\yaml\__init__.py", line 72, in load
    return loader.get_single_data()
  File "C:\Users\mcollier\AppData\Roaming\Python\Python36\site-packages\yaml\constructor.py", line 35, in get_single_data
    node = self.get_single_node()
  File "C:\Users\mcollier\AppData\Roaming\Python\Python36\site-packages\yaml\composer.py", line 36, in get_single_node
    document = self.compose_document()
  File "C:\Users\mcollier\AppData\Roaming\Python\Python36\site-packages\yaml\composer.py", line 55, in compose_document
    node = self.compose_node(None, None)
  File "C:\Users\mcollier\AppData\Roaming\Python\Python36\site-packages\yaml\composer.py", line 84, in compose_node
    node = self.compose_mapping_node(anchor)
  File "C:\Users\mcollier\AppData\Roaming\Python\Python36\site-packages\yaml\composer.py", line 133, in compose_mapping_node
    item_value = self.compose_node(node, item_key)
  File "C:\Users\mcollier\AppData\Roaming\Python\Python36\site-packages\yaml\composer.py", line 82, in compose_node
    node = self.compose_sequence_node(anchor)
  File "C:\Users\mcollier\AppData\Roaming\Python\Python36\site-packages\yaml\composer.py", line 111, in compose_sequence_node
    node.value.append(self.compose_node(node, index))
  File "C:\Users\mcollier\AppData\Roaming\Python\Python36\site-packages\yaml\composer.py", line 84, in compose_node
    node = self.compose_mapping_node(anchor)
  File "C:\Users\mcollier\AppData\Roaming\Python\Python36\site-packages\yaml\composer.py", line 127, in compose_mapping_node
    while not self.check_event(MappingEndEvent):
  File "C:\Users\mcollier\AppData\Roaming\Python\Python36\site-packages\yaml\parser.py", line 98, in check_event
    self.current_event = self.state()
  File "C:\Users\mcollier\AppData\Roaming\Python\Python36\site-packages\yaml\parser.py", line 428, in parse_block_mapping_key
    if self.check_token(KeyToken):
  File "C:\Users\mcollier\AppData\Roaming\Python\Python36\site-packages\yaml\scanner.py", line 116, in check_token
    self.fetch_more_tokens()
  File "C:\Users\mcollier\AppData\Roaming\Python\Python36\site-packages\yaml\scanner.py", line 220, in fetch_more_tokens
    return self.fetch_value()
  File "C:\Users\mcollier\AppData\Roaming\Python\Python36\site-packages\yaml\scanner.py", line 576, in fetch_value
    self.get_mark())
yaml.scanner.ScannerError: mapping values are not allowed here
  in "<unicode string>", line 17, column 30:
                and can be values: 'Binary', 'Int64', 'Double', ' ...
                                 ^

Cannot upgrade cluster from 5.7.198.9494 to latest

My cluster is currently version 5.7.198.9494. It is supposed to be supported until December 15th, 45 days away. I need to upgrade it in time to stay supported.

I'm running sfctl 1.1.0, and it doesn't have sfctl cluster upgrade. So I upgrade to sfctl 3.0.0, which has the command. Unfortunately, when I run it, I get an error Operation returned an invalid status code 'Bad Request'. It's nearly identical to the stack trace found in this issue. It appears that this version of sfctl can't talk to older versions of the cluster since the API changed. The recommended fix at the bottom is to install the older version of sfctl... 1.1.0. Which doesn't have the upgrade command.

Stuck between a rock and a hard place. Thoughts on a fix?

sfctl conflicts with recent azure-cli

[Info]

  • sfctl version: 4.0.0
  • azure cli version: 2.0.27
  • service fabric hosting location: azure

[Reason]

two recent cli uses incompatible knack library of different version.
current sfctl cli uses [email protected]
current az cli uses [email protected]

[Error]

PS C:\Users\me> pip install sfctl
PS C:\Users\me> pip install azure-cli
PS C:\Users\me> sfctl
Traceback (most recent call last):
File "c:\python36\lib\runpy.py", line 193, in run_module_as_main
"main", mod_spec)
File "c:\python36\lib\runpy.py", line 85, in run_code
exec(code, run_globals)
File "C:\Users\me\AppData\Roaming\Python\Python36\Scripts\sfctl.exe_main
.py", line 5, in
File "C:\Users\me\AppData\Roaming\Python\Python36\site-packages\sfctl_init
.py", line 16, in
from sfctl.entry import launch
File "C:\Users\me\AppData\Roaming\Python\Python36\site-packages\sfctl\entry.py", line 16, in
from sfctl.commands import SFCommandLoader, SFCommandHelp
File "C:\Users\me\AppData\Roaming\Python\Python36\site-packages\sfctl\commands.py", line 14, in
from knack.commands import CLICommandsLoader, CommandSuperGroup
ImportError: cannot import name 'CommandSuperGroup'

[My solution]

PS> pip check
sfctl 4.0.0 has requirement knack==0.1.1, but you have knack 0.3.1.

PS> pip uninstall knack
PS> pip install knack==0.1.1

sfctl okay.
but azure-cli error occurs.

PS> az
init() got multiple values for argument 'ctx'
Traceback (most recent call last):
File "C:\Python36\lib\site-packages\knack\cli.py", line 124, in invoke
initial_data=initial_invocation_data)
File "C:\Python36\lib\site-packages\knack\invocation.py", line 31, in init
self.parser = parser_cls(ctx=self.ctx, prog=self.ctx.name, parents=[self._global_parser])
File "C:\Users\me\AppData\Roaming\Python\Python36\site-packages\azure\cli\core\parser.py", line 39, in init
super(AzCliCommandParser, self).init(cli_ctx, cli_help=cli_help, **kwargs)
TypeError: init() got multiple values for argument 'ctx'

Cluster drops connection unexpectedly during application upload

When running the application upload command, when a session is created it appears to be terminated early due to the underlying TCP connection being closed gracefully by the server.

This ends the session early, and in the case of an HTTPS connection, will require re prompting for certificate pass phrases.

Found during #11, related to #9

Attempting to provision the same application package twice results in an invalid status code

When calling application provision on an application type that has already been provisioned, an invalid response code of 409 is returned.

Operation returned an invalid status code 'Conflict'
Traceback (most recent call last):
  File "/home/imang/.local/lib/python3.5/site-packages/knack/cli.py", line 125, in invoke
    cmd_result = self.invocation.execute(args)
  File "/home/imang/.local/lib/python3.5/site-packages/knack/invocation.py", line 85, in execute
    cmd_result = parsed_args.func(params)
  File "/home/imang/.local/lib/python3.5/site-packages/knack/commands.py", line 67, in __call__
    return self.handler(*args, **kwargs)
  File "/home/imang/.local/lib/python3.5/site-packages/knack/commands.py", line 123, in _command_handler
    result = op(client, **command_args) if client else op(**command_args)
  File "/home/imang/.local/lib/python3.5/site-packages/azure/servicefabric/service_fabric_client_ap_is.py", line 2613, in provision_application_type
    raise models.FabricErrorException(self._deserialize, response)
azure.servicefabric.models.fabric_error.FabricErrorException: Operation returned an invalid status code 'Conflict'

This is a bug in the API specification for application provision.

uninstall script returns 500 error and renders cluster unusable

Running the uninstall.sh script generated by Yeoman on a cluster returns an error and renders that cluster unusable until you manually delete the code packages on the nodes. The script will successfully delete and unprovision the application but there will be left over data on the nodes. The error is shown below for when you run the uninstall.sh script:

`Error occurred in request., ConnectionError: HTTPConnectionPool(host='sfpmlinuxignite.eastus.cloudapp.azure.com', port=19080): Max retries exceeded with url: /ImageStore/SimpleContainerApp?api-version=3.0&timeout=60 (Caused by ProtocolError('Connection aborted.', RemoteDisconnected('Remote end closed connection without response',)))
Traceback (most recent call last):
File "/home/servicefabricpm/.local/lib/python3.6/site-packages/urllib3/connectionpool.py", line 601, in urlopen
chunked=chunked)
File "/home/servicefabricpm/.local/lib/python3.6/site-packages/urllib3/connectionpool.py", line 387, in _make_request
six.raise_from(e, None)
File "", line 2, in raise_from
File "/home/servicefabricpm/.local/lib/python3.6/site-packages/urllib3/connectionpool.py", line 383, in _make_request
httplib_response = conn.getresponse()
File "/usr/lib/python3.6/http/client.py", line 1331, in getresponse
response.begin()
File "/usr/lib/python3.6/http/client.py", line 297, in begin
version, status, reason = self._read_status()
File "/usr/lib/python3.6/http/client.py", line 266, in _read_status
raise RemoteDisconnected("Remote end closed connection without"
http.client.RemoteDisconnected: Remote end closed connection without response

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/home/servicefabricpm/.local/lib/python3.6/site-packages/requests/adapters.py", line 440, in send
timeout=timeout
File "/home/servicefabricpm/.local/lib/python3.6/site-packages/urllib3/connectionpool.py", line 668, in urlopen
**response_kw)
File "/home/servicefabricpm/.local/lib/python3.6/site-packages/urllib3/connectionpool.py", line 668, in urlopen
**response_kw)
File "/home/servicefabricpm/.local/lib/python3.6/site-packages/urllib3/connectionpool.py", line 668, in urlopen
**response_kw)
File "/home/servicefabricpm/.local/lib/python3.6/site-packages/urllib3/connectionpool.py", line 639, in urlopen
_stacktrace=sys.exc_info()[2])
File "/home/servicefabricpm/.local/lib/python3.6/site-packages/urllib3/util/retry.py", line 388, in increment
raise MaxRetryError(_pool, url, error or ResponseError(cause))
urllib3.exceptions.MaxRetryError: HTTPConnectionPool(host='sfpmlinuxignite.eastus.cloudapp.azure.com', port=19080): Max retries exceeded with url: /ImageStore/SimpleContainerApp?api-version=3.0&timeout=60 (Caused by ProtocolError('Connection aborted.', RemoteDisconnected('Remote end closed connection without response',)))

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/home/servicefabricpm/.local/lib/python3.6/site-packages/msrest/service_client.py", line 189, in send
**kwargs)
File "/home/servicefabricpm/.local/lib/python3.6/site-packages/requests/sessions.py", line 508, in request
resp = self.send(prep, **send_kwargs)
File "/home/servicefabricpm/.local/lib/python3.6/site-packages/requests/sessions.py", line 618, in send
r = adapter.send(request, **kwargs)
File "/home/servicefabricpm/.local/lib/python3.6/site-packages/requests/adapters.py", line 508, in send
raise ConnectionError(e, request=request)
requests.exceptions.ConnectionError: HTTPConnectionPool(host='sfpmlinuxignite.eastus.cloudapp.azure.com', port=19080): Max retries exceeded with url: /ImageStore/SimpleContainerApp?api-version=3.0&timeout=60 (Caused by ProtocolError('Connection aborted.', RemoteDisconnected('Remote end closed connection without response',)))

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/home/servicefabricpm/.local/lib/python3.6/site-packages/knack/cli.py", line 125, in invoke
cmd_result = self.invocation.execute(args)
File "/home/servicefabricpm/.local/lib/python3.6/site-packages/knack/invocation.py", line 85, in execute
cmd_result = parsed_args.func(params)
File "/home/servicefabricpm/.local/lib/python3.6/site-packages/knack/commands.py", line 67, in call
return self.handler(*args, **kwargs)
File "/home/servicefabricpm/.local/lib/python3.6/site-packages/knack/commands.py", line 123, in _command_handler
result = op(client, **command_args) if client else op(**command_args)
File "/home/servicefabricpm/.local/lib/python3.6/site-packages/azure/servicefabric/service_fabric_client_ap_is.py", line 8141, in delete_image_store_content
response = self._client.send(request, header_parameters, **operation_config)
File "/home/servicefabricpm/.local/lib/python3.6/site-packages/msrest/service_client.py", line 215, in send
raise_with_traceback(ClientRequestError, msg, err)
File "/home/servicefabricpm/.local/lib/python3.6/site-packages/msrest/exceptions.py", line 47, in raise_with_traceback
raise error.with_traceback(exc_traceback)
File "/home/servicefabricpm/.local/lib/python3.6/site-packages/msrest/service_client.py", line 189, in send
**kwargs)
File "/home/servicefabricpm/.local/lib/python3.6/site-packages/requests/sessions.py", line 508, in request
resp = self.send(prep, **send_kwargs)
File "/home/servicefabricpm/.local/lib/python3.6/site-packages/requests/sessions.py", line 618, in send
r = adapter.send(request, **kwargs)
File "/home/servicefabricpm/.local/lib/python3.6/site-packages/requests/adapters.py", line 508, in send
raise ConnectionError(e, request=request)
msrest.exceptions.ClientRequestError: Error occurred in request., ConnectionError: HTTPConnectionPool(host='sfpmlinuxignite.eastus.cloudapp.azure.com', port=19080): Max retries exceeded with url: /ImageStore/SimpleContainerApp?api-version=3.0&timeout=60 (Caused by ProtocolError('Connection aborted.', RemoteDisconnected('Remote end closed connection without response',)))`

Make parameter naming consistent

When specifying Service Fabric entities, different commands use different parameters. For example some commands need a fabric name such as fabric:/App while others just need the id App.

These should be consistently either the name or the id.

Application upload uses multiple sessions

Currently when running application upload, on every request made a user is prompted for authentication when connecting to secure clusters. This also slows down uploads.

Instead, a single session should be used and multiple requests sent through the session.

Provision command removed due to breaking API

The command application provision has been removed due to a compatibility issue with the Service Fabric 6.1 runtime.

This only affects the latest changes, not any released version of sfctl. Found as part of #63

DNS Issue (fabric v6.1) and unrelated cluster start up issue.

Using the localhost cluster. I've done a health check output:

{
  "additionalProperties": {},
  "aggregatedHealthState": "Error",
  "applicationHealthStates": [
    {
      "additionalProperties": {},
      "aggregatedHealthState": "Error",
      "name": "fabric:/System"
    }
  ],
  "healthEvents": [],
  "healthStatistics": {
    "additionalProperties": {},
    "healthStateCountList": [
      {
        "additionalProperties": {},
        "entityKind": "Node",
        "healthStateCount": {
          "additionalProperties": {},
          "errorCount": 0,
          "okCount": 5,
          "warningCount": 0
        }
      },
      {
        "additionalProperties": {},
        "entityKind": "Application",
        "healthStateCount": {
          "additionalProperties": {},
          "errorCount": 0,
          "okCount": 0,
          "warningCount": 0
        }
      },
      {
        "additionalProperties": {},
        "entityKind": "Service",
        "healthStateCount": {
          "additionalProperties": {},
          "errorCount": 0,
          "okCount": 0,
          "warningCount": 0
        }
      },
      {
        "additionalProperties": {},
        "entityKind": "Partition",
        "healthStateCount": {
          "additionalProperties": {},
          "errorCount": 0,
          "okCount": 0,
          "warningCount": 0
        }
      },
      {
        "additionalProperties": {},
        "entityKind": "Replica",
        "healthStateCount": {
          "additionalProperties": {},
          "errorCount": 0,
          "okCount": 0,
          "warningCount": 0
        }
      },
      {
        "additionalProperties": {},
        "entityKind": "DeployedApplication",
        "healthStateCount": {
          "additionalProperties": {},
          "errorCount": 0,
          "okCount": 0,
          "warningCount": 0
        }
      },
      {
        "additionalProperties": {},
        "entityKind": "DeployedServicePackage",
        "healthStateCount": {
          "additionalProperties": {},
          "errorCount": 0,
          "okCount": 0,
          "warningCount": 0
        }
      }
    ]
  },
  "nodeHealthStates": [
    {
      "additionalProperties": {},
      "aggregatedHealthState": "Ok",
      "id": {
        "additionalProperties": {},
        "id": "4f4e3698a196896b5efe8156cc4e1351"
      },
      "name": "_Node_4"
    },
    {
      "additionalProperties": {},
      "aggregatedHealthState": "Ok",
      "id": {
        "additionalProperties": {},
        "id": "6b5c3db003a0bd126f7b8a86fc3916a4"
      },
      "name": "_Node_3"
    },
    {
      "additionalProperties": {},
      "aggregatedHealthState": "Ok",
      "id": {
        "additionalProperties": {},
        "id": "876a44d9185bf9416336b22e5d37cde8"
      },
      "name": "_Node_2"
    },
    {
      "additionalProperties": {},
      "aggregatedHealthState": "Ok",
      "id": {
        "additionalProperties": {},
        "id": "a3784be1d81710242ed0a9632647b4f7"
      },
      "name": "_Node_1"
    },
    {
      "additionalProperties": {},
      "aggregatedHealthState": "Ok",
      "id": {
        "additionalProperties": {},
        "id": "bf865279ba277deb864a976fbf4c200e"
      },
      "name": "_Node_0"
    }
  ],
  "unhealthyEvaluations": [
    {
      "additionalProperties": {},
      "healthEvaluation": {
        "additionalProperties": {},
        "aggregatedHealthState": "Error",
        "description": "System application is unhealthy.",
        "kind": "SystemApplication",
        "unhealthyEvaluations": [
          {
            "additionalProperties": {},
            "healthEvaluation": {
              "additionalProperties": {},
              "aggregatedHealthState": "Error",
              "description": "Unhealthy services: 100% (1/1), ServiceType='DnsServiceType', MaxPercentUnhealthyServices=0%.",
              "kind": "Services",
              "maxPercentUnhealthyServices": 0,
              "serviceTypeName": "DnsServiceType",
              "totalCount": 1,
              "unhealthyEvaluations": [
                {
                  "additionalProperties": {},
                  "healthEvaluation": {
                    "additionalProperties": {},
                    "aggregatedHealthState": "Error",
                    "description": "Unhealthy service: ServiceName='fabric:/System/DnsService', AggregatedHealthState='Error'.",
                    "kind": "Service",
                    "serviceName": "fabric:/System/DnsService",
                    "unhealthyEvaluations": [
                      {
                        "additionalProperties": {},
                        "healthEvaluation": {
                          "additionalProperties": {},
                          "aggregatedHealthState": "Error",
                          "description": "Unhealthy partitions: 100% (1/1), MaxPercentUnhealthyPartitionsPerService=0%.",
                          "kind": "Partitions",
                          "maxPercentUnhealthyPartitionsPerService": 0,
                          "totalCount": 1,
                          "unhealthyEvaluations": [
                            {
                              "additionalProperties": {},
                              "healthEvaluation": {
                                "additionalProperties": {},
                                "aggregatedHealthState": "Error",
                                "description": "Unhealthy partition: PartitionId='e71ec636-6eab-4472-829d-0dc596bd7188', AggregatedHealthState='Error'.",
                                "kind": "Partition",
                                "partitionId": "e71ec636-6eab-4472-829d-0dc596bd7188",
                                "unhealthyEvaluations": [
                                  {
                                    "additionalProperties": {},
                                    "healthEvaluation": {
                                      "additionalProperties": {},
                                      "aggregatedHealthState": "Error",
                                      "considerWarningAsError": false,
                                      "description": "Error event: SourceId='System.FM', Property='State'.",
                                      "kind": "Event",
                                      "unhealthyEvent": {
                                        "additionalProperties": {},
                                        "description": "Partition is below target replica or instance count.\r\nDnsService 1 1 e71ec636-6eab-4472-829d-0dc596bd7188\r\n  IB _Node_3 Up 131764963398090115\r\n  (Showing 1 out of 1 replicas. Total available replicas: 0)\r\n\r\nFor more information see: http://aka.ms/sfhealth",
                                        "healthState": "Error",
                                        "isExpired": false,
                                        "lastErrorTransitionAt": "2018-07-18T20:08:28.423000+00:00",
                                        "lastModifiedUtcTimestamp": "2018-07-19T17:52:41.464000+00:00",
                                        "lastOkTransitionAt": "0001-01-01T00:00:00+00:00",
                                        "lastWarningTransitionAt": "0001-01-01T00:00:00+00:00",
                                        "property": "State",
                                        "removeWhenExpired": false,
                                        "sequenceNumber": "393",
                                        "sourceId": "System.FM",
                                        "sourceUtcTimestamp": "2018-07-19T17:52:19.859000+00:00",
                                        "timeToLiveInMilliSeconds": "10675199 days, 2:48:05.477581"
                                      }
                                    }
                                  }
                                ]
                              }
                            }
                          ]
                        }
                      }
                    ]
                  }
                }
              ]
            }
          }
        ]
      }
    }
  ]
}

I've got issues with the DNS, how do I go about diagnosing it further and fixing it?

Feature request: sfctl logs ...

Having to pipe ETW events from Service Fabric and user application to storage, OMS or AppInsights is tedious. It should be possible to query the logs via sfctl like it is with Docker and Kubernetes (kubeclt logs โ€ฆ)
The logs capacity storage could be limited by time or storage.

It should be able to query at partition and service type level

Listing cluster applications not working

I used to use Azure CLI 2.0 and was working fine.
Last update dropped Service Fabric.

I just installed sfctl. I can select my cluster as previously, seems normal:
sfctl cluster select --endpoint http://cf-imageservice-test.southeastasia.cloudapp.azure.com:19080

Although no output from this command.

When I issue:
sfctl application list

I get the following error:

Operation returned an invalid status code 'Bad Request'
Traceback (most recent call last):
  File "/usr/local/lib/python3.5/dist-packages/knack/cli.py", line 125, in invoke
    cmd_result = self.invocation.execute(args)
  File "/usr/local/lib/python3.5/dist-packages/knack/invocation.py", line 85, in execute
    cmd_result = parsed_args.func(params)
  File "/usr/local/lib/python3.5/dist-packages/knack/commands.py", line 67, in __call__
    return self.handler(*args, **kwargs)
  File "/usr/local/lib/python3.5/dist-packages/knack/commands.py", line 123, in _command_handler
    result = op(client, **command_args) if client else op(**command_args)
  File "/usr/local/lib/python3.5/dist-packages/azure/servicefabric/service_fabric_client_ap_is.py", line 3409, in get_application_info_list
    raise models.FabricErrorException(self._deserialize, response)
azure.servicefabric.models.fabric_error.FabricErrorException: Operation returned an invalid status code 'Bad Request'

Any workarounds?

"--no-verify" option doesn't work

When I try to connect to my cluster on Azure using sfctl I get an error. I assume it is because of the self-signed certificates.

sfctl cluster select --endpoint https://cluster.region.cloudapp.azure.com:19080 --pem ./cluster.pem
Error occurred in request., SSLError: HTTPSConnectionPool(host='cluster.region.cloudapp.azure.com', port=19080): Max retries exceeded with url: / (Caused by SSLError(SSLError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed

Then I pass the --no-verify option, I just get another error that this is not recomended. But then nothing happens.

sfctl cluster select --endpoint https://cluster.region.cloudapp.azure.com:19080 --pem ./cluster.pem --no-verify
c:\program files\python36\lib\site-packages\urllib3\connectionpool.py:858: InsecureRequestWarning: Unverified HTTPS request is being made. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.io/en/latest/advanced-usage.html#ssl-warnings
  InsecureRequestWarning)

I reach the SF Explorer page with Chrome without any problems.
curl of https://cluster.region.cloudapp.azure.com:19080 works als well, when I pass the certificate and the --insecure option.

sfctl version is 3.0.0.
sf runtime version is 6.1.456.9494
hosting on Azure

sfctl cluster select throwing SSLError

When trying to run below command
sfctl cluster select --endpoint https://ankitsf.centralindia.cloudapp.azure.com:19000 --pem ./mycert.pem --no-verify

below error is coming:
Error occurred in request., SSLError: HTTPSConnectionPool(host='ankitsf.centralindia.cloudapp.azure.com', port=19000): Max retries exceeded with url: / (Caused by SSLError(SSLEOFError(8, 'EOF occurred in violation of protocol (_ssl.c:833)'),))
Traceback (most recent call last):
File "/usr/local/lib/python3.6/site-packages/urllib3/connectionpool.py", line 601, in urlopen
chunked=chunked)
File "/usr/local/lib/python3.6/site-packages/urllib3/connectionpool.py", line 346, in _make_request
self._validate_conn(conn)
File "/usr/local/lib/python3.6/site-packages/urllib3/connectionpool.py", line 850, in validate_conn
conn.connect()
File "/usr/local/lib/python3.6/site-packages/urllib3/connection.py", line 326, in connect
ssl_context=context)
File "/usr/local/lib/python3.6/site-packages/urllib3/util/ssl
.py", line 329, in ssl_wrap_socket
return context.wrap_socket(sock, server_hostname=server_hostname)
File "/usr/local/Cellar/python/3.6.5/Frameworks/Python.framework/Versions/3.6/lib/python3.6/ssl.py", line 407, in wrap_socket
_context=self, _session=session)
File "/usr/local/Cellar/python/3.6.5/Frameworks/Python.framework/Versions/3.6/lib/python3.6/ssl.py", line 814, in init
self.do_handshake()
File "/usr/local/Cellar/python/3.6.5/Frameworks/Python.framework/Versions/3.6/lib/python3.6/ssl.py", line 1068, in do_handshake
self._sslobj.do_handshake()
File "/usr/local/Cellar/python/3.6.5/Frameworks/Python.framework/Versions/3.6/lib/python3.6/ssl.py", line 689, in do_handshake
self._sslobj.do_handshake()
ssl.SSLEOFError: EOF occurred in violation of protocol (_ssl.c:833)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/usr/local/lib/python3.6/site-packages/requests/adapters.py", line 440, in send
timeout=timeout
File "/usr/local/lib/python3.6/site-packages/urllib3/connectionpool.py", line 668, in urlopen
**response_kw)
File "/usr/local/lib/python3.6/site-packages/urllib3/connectionpool.py", line 668, in urlopen
**response_kw)
File "/usr/local/lib/python3.6/site-packages/urllib3/connectionpool.py", line 668, in urlopen
**response_kw)
File "/usr/local/lib/python3.6/site-packages/urllib3/connectionpool.py", line 639, in urlopen
_stacktrace=sys.exc_info()[2])
File "/usr/local/lib/python3.6/site-packages/urllib3/util/retry.py", line 388, in increment
raise MaxRetryError(_pool, url, error or ResponseError(cause))
urllib3.exceptions.MaxRetryError: HTTPSConnectionPool(host='ankitsf.centralindia.cloudapp.azure.com', port=19000): Max retries exceeded with url: / (Caused by SSLError(SSLEOFError(8, 'EOF occurred in violation of protocol (_ssl.c:833)'),))

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/usr/local/lib/python3.6/site-packages/msrest/service_client.py", line 201, in send
**kwargs)
File "/usr/local/lib/python3.6/site-packages/requests/sessions.py", line 508, in request
resp = self.send(prep, **send_kwargs)
File "/usr/local/lib/python3.6/site-packages/requests/sessions.py", line 618, in send
r = adapter.send(request, **kwargs)
File "/usr/local/lib/python3.6/site-packages/requests/adapters.py", line 506, in send
raise SSLError(e, request=request)
requests.exceptions.SSLError: HTTPSConnectionPool(host='ankitsf.centralindia.cloudapp.azure.com', port=19000): Max retries exceeded with url: / (Caused by SSLError(SSLEOFError(8, 'EOF occurred in violation of protocol (_ssl.c:833)'),))

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/usr/local/lib/python3.6/site-packages/knack/cli.py", line 125, in invoke
cmd_result = self.invocation.execute(args)
File "/usr/local/lib/python3.6/site-packages/knack/invocation.py", line 85, in execute
cmd_result = parsed_args.func(params)
File "/usr/local/lib/python3.6/site-packages/knack/commands.py", line 67, in call
return self.handler(*args, **kwargs)
File "/usr/local/lib/python3.6/site-packages/knack/commands.py", line 123, in _command_handler
result = op(client, **command_args) if client else op(**command_args)
File "/usr/local/lib/python3.6/site-packages/sfctl/custom_cluster.py", line 95, in select
rest_client.send(rest_client.get('/')).raise_for_status()
File "/usr/local/lib/python3.6/site-packages/msrest/service_client.py", line 227, in send
raise_with_traceback(ClientRequestError, msg, err)
File "/usr/local/lib/python3.6/site-packages/msrest/exceptions.py", line 45, in raise_with_traceback
raise error.with_traceback(exc_traceback)
File "/usr/local/lib/python3.6/site-packages/msrest/service_client.py", line 201, in send
**kwargs)
File "/usr/local/lib/python3.6/site-packages/requests/sessions.py", line 508, in request
resp = self.send(prep, **send_kwargs)
File "/usr/local/lib/python3.6/site-packages/requests/sessions.py", line 618, in send
r = adapter.send(request, **kwargs)
File "/usr/local/lib/python3.6/site-packages/requests/adapters.py", line 506, in send
raise SSLError(e, request=request)
msrest.exceptions.ClientRequestError: Error occurred in request., SSLError: HTTPSConnectionPool(host='ankitsf.centralindia.cloudapp.azure.com', port=19000): Max retries exceeded with url: / (Caused by SSLError(SSLEOFError(8, 'EOF occurred in violation of protocol (_ssl.c:833)'),))

ankit.choudhary$ pip show sfctl
Name: sfctl
Version: 4.0.0
Summary: Azure Service Fabric command line
Home-page: https://github.com/Azure/service-fabric-cli
Author: Microsoft Corporation
Author-email: [email protected]
License: MIT
Location: /Users/ankit.choudhary/Library/Python/2.7/lib/python/site-packages
Requires: msrest, future, adal, jsonpickle, azure-servicefabric, knack, requests

Service Fabric deployed on cloud

SERVICE FABRIC VERSION
6.1.187.1

ICommunicationListener.CloseAsync not called on replica removed when force-remove=false

I'm trying to issue a sfctl replica remove command to gracefully restart my stateless service process.
when using this command:

sfctl replica remove --node-name mynodename --partition-id mypartitionid --replica-id myinstanceid

ICommunicationListener.CloseAsync is not called and instead ICommunicationListener.Abort is called.

when using the force-remove=false flag neither the ICommunicationListener.Abort nor the ICommunicationListener.CloseAsync functions get called.

What is the expected behavior for replica remove with --force-remove=false? what is the default? how can i achieve graceful restart of my stateless service process?

Fresh CLI install failed

I'm following this:

https://docs.microsoft.com/en-us/azure/service-fabric/service-fabric-cli#install-pip-python-and-the-service-fabric-cli

I got python installed ran versions check, then tried to install sfctl:

C:\WINDOWS\system32> python --version
Python 3.7.0
C:\WINDOWS\system32> pip --version
pip 10.0.1 from c:\users\melman\appdata\local\programs\python\python37\lib\site-packages\pip (python 3.7)
C:\WINDOWS\system32> pip install sfctl
Collecting sfctl
Could not find a version that satisfies the requirement sfctl (from versions: )
No matching distribution found for sfctl

please add a option to show the current connected cluster

I wish there is a option when invoke sfctl cluster to check what is the current connected cluster? i made several mistake to deploy the app onto the wrong cluster, after several times then before each deployment, i like to check which cluster i am actually connect to..

sfctl property list returning NULL value

Using sfctl 4.0.0.0.

Running sfctl property list

Returns back
"properties": [ { "additionalProperties": {}, "metadata": { "additionalProperties": {}, "customTypeId": "", "lastModifiedUtcTimestamp": "2018-04-27T01:10:58.382000+00:00", "parent": "fabric:/RachelSF/Web2", "sequenceNumber": "56", "sizeInBytes": 68, "typeId": "String" }, "name": "traefik.frontend.rule.default", "value": null }

VALUE is definitely not set to NULL.
Checking against the REST API directly it shows up correctly..

Adding @jjcollinge and @lawrencegripper as well...

sfctl should validate that it is compatible with Service Fabric runtime on cluster

Connection to a cluster with Fabric runtime that is not supported by installed version of sfctl succeeds but almost none of the other commands work.

Expected behavior:
sfctl should check the version of runtime in sfctl cluster select and if it cannot support the version of Fabric Runtime deployed to the cluster it should give an actionable error.

ERROR: Installed version of sfctl does not support cluster "cluster name".
Cluster us running Service Fabric version(s) - "Versions".
Please visit https://github.com/Azure/service-fabric-cli to determine a compatible version and to install it.

sfctl upload and provision commands on Linux folder clean-up

Running the generated install.sh using the VS Code Service Fabric plugin, I noticed sfctl upload & provision commands are used on Linux but seems folders are not being cleaned-up on failed deployments.

For example looking at the cluster location path(s):

  • /home/sfuser/sfdevcluster/data/ImageBuilderProxy/App
  • /home/sfuser/sfdevcluster/data/ImageBuilderProxy/AppType

I notice these folders are not being cleaned-up even if the deployment fails. Moreover doing a sfctl upload & provision I can see the AppType in Service Fabric Explorer however the /home/sfuser/sfdevcluster/data/ImageBuilderProxy/AppType folder is empty. I'm assuming I should see my application in the AppType folder?

image

image

Lastly even though I do not see any AppType in Service Fabric Explorer, doing a sfctl store root-info still shows the below, should this also be cleaned-up if an AppType is removed via Explorer? Seems this could cause a stale or the wrong package to be deployed if the old and new application packages have the same AppType and version. So my example is a deployment fails or I remove everything via Service Fabric explorer and using sfctl is deploying a cached package which has the same AppType and version.

image

  • [sfctl version 5.0.0 ]
  • [ 6.3.119.1]
  • [ Ubuntu]

cc @suhuruli

"sfctl application upgrade" seems to be broken

It appears that upgrading a service-fabric application via sfctl application upgrade is completely broken.

I'm attempting to upgrade using the stand procedure documented here: https://docs.microsoft.com/en-us/azure/service-fabric/service-fabric-application-lifecycle-sfctl#upgrade-application

I can upload and provision the new version fine, and it shows up in the Service Fabric explorer. But running sfctl application upgrade --app-id sf-test --parameters "{}" --health-check-stable-duration 60 --upgrade-domain-timeout 1200 --upgrade-timeout 3000 --mode Monitored throws a 500 error:

Error occurred in request., RetryError: HTTPConnectionPool(host='localhost', port=19080): Max retries exceeded with url: /Applications/sf-test/$/Upgrade?timeout=60&api-version=6.0 (Caused by ResponseError('too many 500 error responses',))

However, I can successfully upgrade the app with this PowerShell command:

Start-ServiceFabricApplicationUpgrade -ApplicationName "fabric:/sf-test" -ApplicationTypeVersion "2.0.0" -HealthCheckStableDurationSec 60 -UpgradeDomainTimeoutSec 1200 -UpgradeTimeout 3000 -FailureAction Rollback -Monitored

I also tried this on the EchoService and VisualObject samples in this repo: https://github.com/Azure-Samples/service-fabric-java-getting-started

Same deal.

My Environment:

Bash on Ubuntu 16.04 LTS, installed sfctl via: sudo curl -s https://raw.githubusercontent.com/Azure/service-fabric-scripts-and-templates/master/scripts/SetupServiceFabric/SetupServiceFabric.sh | sudo bash

`c_rehash` must be run on CA Cert Folder

When reporting a new issue include the following information:

  • sfctl version, can check this using pip show sfctl
6.0.0

Python (Linux) 2.7.12 (default, Dec  4 2017, 14:50:18)
[GCC 5.4.0 20160609]

Python location '/usr/bin/python'
  • Service Fabric cluster runtime version
6.3.129.1
  • Service Fabric hosting location (on-premise or Azure usually)
On-Premise - linux
  • Debug log if an error is present (can be captured using --debug flag)
Command arguments: ['--debug', 'cluster', 'select', '--endpoint', 'https://service-fabric.example.com:19080', '--cert', '/home/vagrant/test-certs/admin_client.crt', '--key', '/home/vagrant/test-certs/admin_client.key', '--ca', '/home/vagrant/test-certs/']
Event: Cli.PreExecute []
Event: CommandParser.OnGlobalArgumentsCreate [<function on_global_arguments at 0x7fbbe1a1c410>, <function on_global_arguments at 0x7fbbe1a44050>, <function on_global_arguments at 0x7fbbe19db668>]
Event: CommandInvoker.OnPreCommandTableCreate [<function remove_logger_flags at 0x7fbbe1a1c488>]
Event: CommandLoader.OnLoadArguments []
Event: CommandInvoker.OnPostCommandTableCreate []
Event: CommandInvoker.OnCommandTableLoaded []
Event: CommandInvoker.OnPreParseArgs []
Event: CommandInvoker.OnPostParseArgs [<function handle_output_argument at 0x7fbbe1a440c8>, <function handle_query_parameter at 0x7fbbe19db6e0>]
msrest.service_client : Accept header absent and forced to application/json
msrest.pipeline : Configuring request: timeout=100, verify=True, cert=None
msrest.pipeline : Configuring proxies: ''
msrest.pipeline : Evaluate proxies against ENV settings: True
msrest.pipeline : Configuring redirects: allow=True, max=30
msrest.pipeline : Configuring retry: max_retries=3, backoff_factor=0.8, max_backoff=90
urllib3.connectionpool : Starting new HTTPS connection (1): service-fabric.example.com:19080
urllib3.util.retry : Incremented Retry for (url='/'): Retry(total=2, connect=3, read=3, redirect=None, status=None)
urllib3.connectionpool : Retrying (Retry(total=2, connect=3, read=3, redirect=None, status=None)) after connection broken by 'SSLError(SSLError(1, u'[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:590)'),)': /
urllib3.connectionpool : Starting new HTTPS connection (2): service-fabric.example.com:19080
urllib3.util.retry : Incremented Retry for (url='/'): Retry(total=1, connect=3, read=3, redirect=None, status=None)
urllib3.connectionpool : Retrying (Retry(total=1, connect=3, read=3, redirect=None, status=None)) after connection broken by 'SSLError(SSLError(1, u'[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:590)'),)': /
urllib3.connectionpool : Starting new HTTPS connection (3): service-fabric.example.com:19080
urllib3.util.retry : Incremented Retry for (url='/'): Retry(total=0, connect=3, read=3, redirect=None, status=None)
urllib3.connectionpool : Retrying (Retry(total=0, connect=3, read=3, redirect=None, status=None)) after connection broken by 'SSLError(SSLError(1, u'[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:590)'),)': /
urllib3.connectionpool : Starting new HTTPS connection (4): service-fabric.example.com:19080
msrest.exceptions : Error occurred in request., SSLError: HTTPSConnectionPool(host='service-fabric.example.com', port=19080): Max retries exceeded with url: / (Caused by SSLError(SSLError(1, u'[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:590)'),))
Error occurred in request., SSLError: HTTPSConnectionPool(host='service-fabric.example.com', port=19080): Max retries exceeded with url: / (Caused by SSLError(SSLError(1, u'[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:590)'),))
Traceback (most recent call last):
  File "/home/vagrant/.local/lib/python2.7/site-packages/knack/cli.py", line 125, in invoke
    cmd_result = self.invocation.execute(args)
  File "/home/vagrant/.local/lib/python2.7/site-packages/knack/invocation.py", line 85, in execute
    cmd_result = parsed_args.func(params)
  File "/home/vagrant/.local/lib/python2.7/site-packages/knack/commands.py", line 67, in __call__
    return self.handler(*args, **kwargs)
  File "/home/vagrant/.local/lib/python2.7/site-packages/knack/commands.py", line 123, in _command_handler
    result = op(client, **command_args) if client else op(**command_args)
  File "/home/vagrant/.local/lib/python2.7/site-packages/sfctl/custom_cluster.py", line 104, in select
    rest_client.send(rest_client.get('/')).raise_for_status()
  File "/home/vagrant/.local/lib/python2.7/site-packages/msrest/service_client.py", line 369, in send
    raise_with_traceback(ClientRequestError, msg, err)
  File "/home/vagrant/.local/lib/python2.7/site-packages/msrest/exceptions.py", line 57, in raise_with_traceback
    raise error
ClientRequestError: Error occurred in request., SSLError: HTTPSConnectionPool(host='service-fabric.example.com', port=19080): Max retries exceeded with url: / (Caused by SSLError(SSLError(1, u'[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:590)'),))

Be sure to check if an issue already exists with your symptoms. If so, leave a :thumbsup: reaction to the original issue, rather than creating a duplicate.

When using a directory in the --ca flag, c_rehash must be run on the directory before attempting to run sfctl cluster select otherwise the CA certs in the directory will be ignored. This is not currently listed in the documentation of help materials - and the error message does not allude to this being the case (just that the cert is invalid)

Receiving invalid argument response on most commands

  • sfctl version: 3.0
  • Service Fabric cluster runtime version: 6.1.183.1
  • Service Fabric hosting location: Azure
  • Local OS: Ubuntu 17.10

When running seemingly any command that interacts with the cluster I am getting an invalid argument response.

sfctl cluster health --debug

Event: Cli.PreExecute []
Event: CommandParser.OnGlobalArgumentsCreate [<function CLILogging.on_global_arguments at 0x7fddd693d158>, <function OutputProducer.on_global_arguments at 0x7fddd62198c8>, <function CLIQuery.on_global_arguments at 0x7fddd5fb9510>]
Event: CommandInvoker.OnPreCommandTableCreate [<function CLILogging.remove_logger_flags at 0x7fddd693d1e0>]
Event: CommandLoader.OnLoadArguments []
Event: CommandInvoker.OnPostCommandTableCreate []
Event: CommandInvoker.OnCommandTableLoaded []
Event: CommandInvoker.OnPreParseArgs []
Event: CommandInvoker.OnPostParseArgs [<function OutputProducer.handle_output_argument at 0x7fddd6219950>, <function CLIQuery.handle_query_parameter at 0x7fddd5fb9598>]
msrest.pipeline : Configuring request: timeout=100, verify=True, cert=None
msrest.pipeline : Configuring redirects: allow=True, max=30
msrest.pipeline : Configuring proxies: ''
msrest.pipeline : Evaluate proxies against ENV settings: True
msrest.pipeline : Configuring retry: max_retries=3, backoff_factor=0.8, max_backoff=90
urllib3.connectionpool : Starting new HTTPS connection (1): 10.1.0.5
urllib3.connectionpool : https://10.1.0.5:19080 "GET /Explorer/$/GetClusterHealth?api-version=6.0&NodesHealthStateFilter=0&ApplicationsHealthStateFilter=0&EventsHealthStateFilter=0&ExcludeHealthStatistics=false&IncludeSystemApplicationHealthStatistics=false&timeout=60 HTTP/1.1" 400 62
msrest.http_logger : Request URL: 'https://10.1.0.5:19080/Explorer/$/GetClusterHealth?api-version=6.0&NodesHealthStateFilter=0&ApplicationsHealthStateFilter=0&EventsHealthStateFilter=0&ExcludeHealthStatistics=false&IncludeSystemApplicationHealthStatistics=false&timeout=60'
msrest.http_logger : Request method: 'GET'
msrest.http_logger : Request headers:
msrest.http_logger :     'User-Agent': 'python/3.6.3 (Linux-4.13.0-32-generic-x86_64-with-Ubuntu-17.10-artful) requests/2.18.4 msrest/0.4.26 servicefabricclientapis/6.0'
msrest.http_logger :     'Accept-Encoding': 'gzip, deflate'
msrest.http_logger :     'Accept': 'application/json'
msrest.http_logger :     'Connection': 'keep-alive'
msrest.http_logger :     'Content-Type': 'application/json; charset=utf-8'
msrest.http_logger : Request body:
msrest.http_logger : None
msrest.http_logger : Response status: 400
msrest.http_logger : Response headers:
msrest.http_logger :     'Content-Length': '62'
msrest.http_logger :     'Content-Type': 'application/json; charset=utf-8'
msrest.http_logger :     'X-Content-Type-Options': 'nosniff'
msrest.http_logger : Response content:
msrest.http_logger : b'{"Error":{"Code":"E_INVALIDARG","Message":"Invalid argument"}}'
msrest.exceptions : (E_INVALIDARG) Invalid argument
(E_INVALIDARG) Invalid argument
Traceback (most recent call last):
  File "/home/jordan/.local/lib/python3.6/site-packages/knack/cli.py", line 125, in invoke
    cmd_result = self.invocation.execute(args)
  File "/home/jordan/.local/lib/python3.6/site-packages/knack/invocation.py", line 85, in execute
    cmd_result = parsed_args.func(params)
  File "/home/jordan/.local/lib/python3.6/site-packages/knack/commands.py", line 67, in __call__
    return self.handler(*args, **kwargs)
  File "/home/jordan/.local/lib/python3.6/site-packages/knack/commands.py", line 123, in _command_handler
    result = op(client, **command_args) if client else op(**command_args)
  File "/home/jordan/.local/lib/python3.6/site-packages/azure/servicefabric/service_fabric_client_ap_is.py", line 299, in get_cluster_health
    raise models.FabricErrorException(self._deserialize, response)
azure.servicefabric.models.fabric_error.FabricErrorException: (E_INVALIDARG) Invalid argument

Application upgrade expects a name instead of an id

When running sfctl application upgrade the --app-id parameter expects a name in the format of fabric:/testapp instead of just testapp. This is misleading sine usually application names start with fabric:/ and not Ids.

sfctl application provision --application-type-build-path testPackage fails

I upload my package with the command sfctl application upload --path testPackage --show-progress as usually and this succeeds.

I try to provision my application with:
sfctl application provision --application-type-build-path testPackage and it will fail with this error:

The same operation using Azure CLI 2.x used to work fine.
Since moved to sfctl it does not work anymore.

Error occurred in request., RetryError: HTTPConnectionPool(host='xx.xx.xx.xx', port=19080): Max retries exceeded with url: /ApplicationTypes/$/Provision?api-version=6.0&timeout=60 (Caused by ResponseError('too many 500 error responses',))
Traceback (most recent call last):
  File "/home/josem/.local/lib/python3.6/site-packages/requests/adapters.py", line 440, in send
    timeout=timeout
  File "/home/josem/.local/lib/python3.6/site-packages/urllib3/connectionpool.py", line 732, in urlopen
    body_pos=body_pos, **response_kw)
  File "/home/josem/.local/lib/python3.6/site-packages/urllib3/connectionpool.py", line 732, in urlopen
    body_pos=body_pos, **response_kw)
  File "/home/josem/.local/lib/python3.6/site-packages/urllib3/connectionpool.py", line 732, in urlopen
    body_pos=body_pos, **response_kw)
  File "/home/josem/.local/lib/python3.6/site-packages/urllib3/connectionpool.py", line 712, in urlopen
    retries = retries.increment(method, url, response=response, _pool=self)
  File "/home/josem/.local/lib/python3.6/site-packages/urllib3/util/retry.py", line 388, in increment
    raise MaxRetryError(_pool, url, error or ResponseError(cause))
urllib3.exceptions.MaxRetryError: HTTPConnectionPool(host='xx.xx.xx.xx', port=19080): Max retries exceeded with url: /ApplicationTypes/$/Provision?api-version=6.0&timeout=60 (Caused by ResponseError('too many 500 error responses',))

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/josem/.local/lib/python3.6/site-packages/msrest/service_client.py", line 199, in send
    **kwargs)
  File "/home/josem/.local/lib/python3.6/site-packages/requests/sessions.py", line 508, in request
    resp = self.send(prep, **send_kwargs)
  File "/home/josem/.local/lib/python3.6/site-packages/requests/sessions.py", line 618, in send
    r = adapter.send(request, **kwargs)
  File "/home/josem/.local/lib/python3.6/site-packages/requests/adapters.py", line 499, in send
    raise RetryError(e, request=request)
requests.exceptions.RetryError: HTTPConnectionPool(host='xx.xx.xx.xx', port=19080): Max retries exceeded with url: /ApplicationTypes/$/Provision?api-version=6.0&timeout=60 (Caused by ResponseError('too many 500 error responses',))

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/xxx/.local/lib/python3.6/site-packages/knack/cli.py", line 125, in invoke
    cmd_result = self.invocation.execute(args)
  File "/home/xxx/.local/lib/python3.6/site-packages/knack/invocation.py", line 85, in execute
    cmd_result = parsed_args.func(params)
  File "/home/xxx/.local/lib/python3.6/site-packages/knack/commands.py", line 67, in __call__
    return self.handler(*args, **kwargs)
  File "/home/xxx/.local/lib/python3.6/site-packages/knack/commands.py", line 123, in _command_handler
    result = op(client, **command_args) if client else op(**command_args)
  File "/home/xxx/.local/lib/python3.6/site-packages/azure/servicefabric/service_fabric_client_ap_is.py", line 2693, in provision_application_type
    request, header_parameters, body_content, **operation_config)
  File "/home/xxx/.local/lib/python3.6/site-packages/msrest/service_client.py", line 225, in send
    raise_with_traceback(ClientRequestError, msg, err)
  File "/home/xxx/.local/lib/python3.6/site-packages/msrest/exceptions.py", line 45, in raise_with_traceback
    raise error.with_traceback(exc_traceback)
  File "/home/xxx/.local/lib/python3.6/site-packages/msrest/service_client.py", line 199, in send
    **kwargs)
  File "/home/xxx/.local/lib/python3.6/site-packages/requests/sessions.py", line 508, in request
    resp = self.send(prep, **send_kwargs)
  File "/home/josem/.local/lib/python3.6/site-packages/requests/sessions.py", line 618, in send
    r = adapter.send(request, **kwargs)
  File "/home/xxx/.local/lib/python3.6/site-packages/requests/adapters.py", line 499, in send
    raise RetryError(e, request=request)
msrest.exceptions.ClientRequestError: Error occurred in request., RetryError: HTTPConnectionPool(host='xx.xx.xx.xx', port=19080): Max retries exceeded with url: /ApplicationTypes/$/Provision?api-version=6.0&timeout=60 (Caused by ResponseError('too many 500 error responses',))

Where I put some x's to not to expose sensitive information.

The log in the server says:

Info,2746,2589,HttpGateway.HttpGatewayRequestHandler,Invalid URL - http://localhost/ApplicationTypes/$/Provision

But that is not the url that I used. I used the url http://xx.xx.xx.xx:19080/ApplicationTypes/$/Provision, so that might be indeed the bug.

`application provision` returns not helpful 500 on client errors

If an application package is malformed or invalid, the application provision API will fail with a 500 response code. This is indicative of a server side error, rather than client and returns no meaningful information about what could be wrong with the application package.

A more detailed response would help reduce debugging times for provision failures.

Unprovision application TypeError

When running the unprovision command:

sfctl application unprovision --application-type-name CalcServiceApp --application-type-version 1.0

A TypeError is raised attempting to deserialise the FabricError type object from the response. The following stack trace is shown:

__init__() takes exactly 2 arguments (1 given)
Traceback (most recent call last):
  File "/Users/samed/source/azure/sf-cli/env27/lib/python2.7/site-packages/knack/cli.py", line 125, in invoke
    cmd_result = self.invocation.execute(args)
  File "/Users/samed/source/azure/sf-cli/env27/lib/python2.7/site-packages/knack/invocation.py", line 85, in execute
    cmd_result = parsed_args.func(params)
  File "/Users/samed/source/azure/sf-cli/env27/lib/python2.7/site-packages/knack/commands.py", line 67, in __call__
    return self.handler(*args, **kwargs)
  File "/Users/samed/source/azure/sf-cli/env27/lib/python2.7/site-packages/knack/commands.py", line 123, in _command_handler
    result = op(client, **command_args) if client else op(**command_args)
  File "/Users/samed/source/azure/sf-cli/env27/lib/python2.7/site-packages/azure/servicefabric/service_fabric_client_ap_is.py", line 2199, in unprovision_application_type
    raise models.FabricErrorException(self._deserialize, response)
  File "/Users/samed/source/azure/sf-cli/env27/lib/python2.7/site-packages/azure/servicefabric/models/fabric_error.py", line 48, in __init__
    super(FabricErrorException, self).__init__(deserialize, response, 'FabricError', *args)
  File "/Users/samed/source/azure/sf-cli/env27/lib/python2.7/site-packages/msrest/exceptions.py", line 138, in __init__
    self.error = deserialize.dependencies[resp_type]()
TypeError: __init__() takes exactly 2 arguments (1 given)

While the unprovision causes an error, subsequent attempts to list the provision application type do not show the application when calling application type-list

Invalid or incorrect application packages will result in 500 errors during `application upgrade`

If there's a mistake in my application package, such as invalid parameter names, or changes in settings that are not allowed, sfctl application upgrade responds with a 500 error message. This is counter-intuitive since a 400 error message is expected when clients send invalid requests or invalid application packages.

Furthermore, there are no details on what is wrong with the application package that was provisioned.

sfctl application upload throws FABRIC_E_SERVICE_DOES_NOT_EXIST

System info:
Windows 10 build 15063
Service fabric runtime 6.0.219.9494
Service fabric SDK 2.8.219.9494
sfctl 3.0.0

Issue
I am trying to use the application upload option in sfctl for a .NET core project in the following manner:
sfctl application upload --path CounterServiceApplication --show-progress

This is found from the sample at Azure-Samples but has thrown the error with every application I've tried.

The command will always result in throwing the following error:
requests.exceptions.HTTPError: 404 Client Error: FABRIC_E_SERVICE_DOES_NOT_EXIST for url: http://192.168.0.57:19080/ImageStore/CounterServiceApplication/ApplicationManifest.xml?api-version=3.0-preview

The full HTTP PUT request is:

HEADERS
PUT http://192.168.0.57:19080/ImageStore/CounterServiceApplication/ApplicationManifest.xml?api-version=3.0-preview HTTP/1.1
Host: 192.168.0.57:19080
User-Agent: python-requests/2.18.4
Accept-Encoding: gzip, deflate
Accept: /
Connection: keep-alive
Content-Length: 2424

BODY

<?xml version="1.0" encoding="utf-8"?>
<ApplicationManifest ApplicationTypeName="CounterServiceApplicationType"
                     ApplicationTypeVersion="1.0.0"
                     xmlns="http://schemas.microsoft.com/2011/01/fabric"
                     xmlns:xsd="http://www.w3.org/2001/XMLSchema"
                     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  <Parameters>
    <Parameter Name="CounterService_MinReplicaSetSize" DefaultValue="3" />
    <Parameter Name="CounterService_PartitionCount" DefaultValue="1" />
    <Parameter Name="CounterService_TargetReplicaSetSize" DefaultValue="3" />
    <Parameter Name="CounterServiceWebService_InstanceCount" DefaultValue="-1" />
  </Parameters>
  <!-- Import the ServiceManifest from the ServicePackage. The ServiceManifestName and ServiceManifestVersion
       should match the Name and Version attributes of the ServiceManifest element defined in the
       ServiceManifest.xml file. -->
  <ServiceManifestImport>
    <ServiceManifestRef ServiceManifestName="CounterServicePkg" ServiceManifestVersion="1.0.0" />
    <ConfigOverrides />
  </ServiceManifestImport>
  <ServiceManifestImport>
    <ServiceManifestRef ServiceManifestName="CounterServiceWebServicePkg" ServiceManifestVersion="1.0.0" />
    <ConfigOverrides />
  </ServiceManifestImport>
  <DefaultServices>
    <!-- The section below creates instances of service types, when an instance of this
         application type is created. You can also create one or more instances of service type using the
         ServiceFabric PowerShell module.

         The attribute ServiceTypeName below must match the name defined in the imported ServiceManifest.xml file. -->
    <Service Name="CounterService">
      <StatefulService ServiceTypeName="CounterServiceType" TargetReplicaSetSize="[CounterService_TargetReplicaSetSize]" MinReplicaSetSize="[CounterService_MinReplicaSetSize]">
        <UniformInt64Partition PartitionCount="[CounterService_PartitionCount]" LowKey="-9223372036854775808" HighKey="9223372036854775807" />
      </StatefulService>
    </Service>
    <Service Name="CounterServiceWebService">
      <StatelessService ServiceTypeName="CounterServiceWebServiceType" InstanceCount="[CounterServiceWebService_InstanceCount]">
        <SingletonPartition />
      </StatelessService>
    </Service>
  </DefaultServices>
</ApplicationManifest>

Enable PEP8

Use both PEP8 and PyLint for style and correctness checks

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.