snapctl 0.31.0__py3-none-any.whl → 0.31.1__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of snapctl might be problematic. Click here for more details.
- snapctl/config/constants.py +2 -1
- snapctl/main.py +12 -11
- {snapctl-0.31.0.dist-info → snapctl-0.31.1.dist-info}/METADATA +8 -5
- {snapctl-0.31.0.dist-info → snapctl-0.31.1.dist-info}/RECORD +6 -6
- {snapctl-0.31.0.dist-info → snapctl-0.31.1.dist-info}/WHEEL +0 -0
- {snapctl-0.31.0.dist-info → snapctl-0.31.1.dist-info}/entry_points.txt +0 -0
snapctl/config/constants.py
CHANGED
|
@@ -2,13 +2,14 @@
|
|
|
2
2
|
Constants used by snapctl
|
|
3
3
|
"""
|
|
4
4
|
COMPANY_NAME = 'Snapser'
|
|
5
|
-
VERSION = '0.31.
|
|
5
|
+
VERSION = '0.31.1'
|
|
6
6
|
CONFIG_FILE_MAC = '~/.snapser/config'
|
|
7
7
|
CONFIG_FILE_WIN = '%homepath%\\.snapser\\config'
|
|
8
8
|
|
|
9
9
|
DEFAULT_PROFILE = 'default'
|
|
10
10
|
API_KEY = 'SNAPSER_API_KEY'
|
|
11
11
|
URL_KEY = 'SNAPSER_URL_KEY'
|
|
12
|
+
CONFIG_PATH_KEY = 'SNAPSER_CONFIG_PATH'
|
|
12
13
|
SERVER_CALL_TIMEOUT = 30
|
|
13
14
|
|
|
14
15
|
SNAPCTL_SUCCESS = 0
|
snapctl/main.py
CHANGED
|
@@ -13,7 +13,7 @@ from snapctl.commands.byogs import ByoGs
|
|
|
13
13
|
from snapctl.commands.game import Game
|
|
14
14
|
from snapctl.commands.snapend import Snapend
|
|
15
15
|
from snapctl.config.constants import COMPANY_NAME, API_KEY, URL_KEY, CONFIG_FILE_MAC, \
|
|
16
|
-
CONFIG_FILE_WIN, DEFAULT_PROFILE, VERSION, SNAPCTL_SUCCESS, SNAPCTL_ERROR
|
|
16
|
+
CONFIG_FILE_WIN, DEFAULT_PROFILE, VERSION, SNAPCTL_SUCCESS, SNAPCTL_ERROR, CONFIG_PATH_KEY
|
|
17
17
|
from snapctl.config.endpoints import END_POINTS
|
|
18
18
|
from snapctl.config.hashes import CLIENT_SDK_TYPES, SERVER_SDK_TYPES, PROTOS_TYPES, SERVICE_IDS, \
|
|
19
19
|
SNAPEND_MANIFEST_TYPES
|
|
@@ -50,22 +50,23 @@ def extract_config(extract_key: str, profile: str | None = None) -> object:
|
|
|
50
50
|
'location': '',
|
|
51
51
|
'value': None
|
|
52
52
|
}
|
|
53
|
-
# Option 1
|
|
53
|
+
# Option 1 - Get the API Key from the environment variable
|
|
54
54
|
env_api_key = os.getenv(extract_key)
|
|
55
55
|
if env_api_key is not None:
|
|
56
56
|
result['location'] = 'environment-variable'
|
|
57
57
|
result['value'] = env_api_key
|
|
58
58
|
return result
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
59
|
+
encoding: str | None = "utf-8-sig" if platform == 'win32' else None
|
|
60
|
+
# Option 2 - Get the API Key from CONFIG PATH environment variable
|
|
61
|
+
config_file_path: str | None = os.getenv(CONFIG_PATH_KEY)
|
|
62
|
+
# Option 3 - Get the API Key from the hardcoded config file we look for
|
|
63
|
+
if config_file_path is None:
|
|
64
|
+
if platform == 'win32':
|
|
65
|
+
config_file_path = os.path.expandvars(CONFIG_FILE_WIN)
|
|
66
|
+
else:
|
|
67
|
+
config_file_path = os.path.expanduser(CONFIG_FILE_MAC)
|
|
68
|
+
result['location'] = f'config-file:{config_file_path}'
|
|
67
69
|
if os.path.isfile(config_file_path):
|
|
68
|
-
result['location'] = 'config-file'
|
|
69
70
|
config = configparser.ConfigParser()
|
|
70
71
|
config.read(config_file_path, encoding=encoding)
|
|
71
72
|
config_profile: str = DEFAULT_PROFILE
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: snapctl
|
|
3
|
-
Version: 0.31.
|
|
3
|
+
Version: 0.31.1
|
|
4
4
|
Summary: Snapser CLI Tool
|
|
5
5
|
Author: Ajinkya Apte
|
|
6
6
|
Author-email: aj@snapser.com
|
|
@@ -101,7 +101,10 @@ be evaluated after verifying if there is any command line argument.
|
|
|
101
101
|
|
|
102
102
|
Create a file named `~/.snapser/config`. Open it using the editor of your choice and replace with your
|
|
103
103
|
personal Snapser Access key. Save the file. Advantage of using this method is you can use the `--profile`
|
|
104
|
-
argument with your snapctl command to use different API keys.
|
|
104
|
+
argument with your snapctl command to use different API keys. NOTE: You may want to pass your own path
|
|
105
|
+
instead on relying on the default one the CLI looks for. You can do so by setting an environment
|
|
106
|
+
variable `SNAPSER_CONFIG_PATH='<your_custom_path>'`. Doing this will make sure that the CLI tool
|
|
107
|
+
will look for the config file at that path.
|
|
105
108
|
|
|
106
109
|
```
|
|
107
110
|
[default]
|
|
@@ -523,9 +526,9 @@ snapctl snapend update --help
|
|
|
523
526
|
# --blocking = (Optional) This makes sure the CLI waits till your Snapend is live.
|
|
524
527
|
# Note at least one of the two needs to be present
|
|
525
528
|
# Example:
|
|
526
|
-
# snapctl snapend update gx5x6bc0 --byosnaps byosnap-service-1:v1.0.0,byosnap-service--2:v1.0.0 --byogs byogs-fleet-one:gs-1:v0.0.1,my-fleet-two:gs-2:v0.0.4
|
|
527
|
-
# snapctl snapend update gx5x6bc0 --byosnaps byosnap-service-1:v1.0.0,byosnap-service--2:v1.0.0 --byogs fleet-one:v0.0.1,fleet-two:v0.0.4 --blocking
|
|
528
|
-
snapctl snapend update $snapend_id --byosnaps $byosnaps --byogs $byogs --blocking
|
|
529
|
+
# snapctl snapend update --snapend-id gx5x6bc0 --byosnaps byosnap-service-1:v1.0.0,byosnap-service--2:v1.0.0 --byogs byogs-fleet-one:gs-1:v0.0.1,my-fleet-two:gs-2:v0.0.4
|
|
530
|
+
# snapctl snapend update --snapend-id gx5x6bc0 --byosnaps byosnap-service-1:v1.0.0,byosnap-service--2:v1.0.0 --byogs fleet-one:v0.0.1,fleet-two:v0.0.4 --blocking
|
|
531
|
+
snapctl snapend update --snapend-id $snapend_id --byosnaps $byosnaps --byogs $byogs --blocking
|
|
529
532
|
```
|
|
530
533
|
|
|
531
534
|
#### 6. Get the Snapend state
|
|
@@ -6,16 +6,16 @@ snapctl/commands/byosnap.py,sha256=RQv3r30dkz8n1BgEnE-tAnAzPLoz-CLEQoiy1WKZQeg,2
|
|
|
6
6
|
snapctl/commands/game.py,sha256=rnsTqrXavE5D-KULXkDBQ-PBI8sSKK4it3S_YMJfiUY,3633
|
|
7
7
|
snapctl/commands/snapend.py,sha256=exMH-8lp9qUociAWHJS15xRr-MtCe1fjbQAQmgODNIw,26187
|
|
8
8
|
snapctl/config/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
9
|
-
snapctl/config/constants.py,sha256=
|
|
9
|
+
snapctl/config/constants.py,sha256=iX5zkftpOqdGJWoCK8-zwP_Mz9GD3BU62DVKrzTygpw,565
|
|
10
10
|
snapctl/config/endpoints.py,sha256=VAeOmx3k3ukB-9XuGI65KtCJwFK-KFgzor-UWE8JU0g,297
|
|
11
11
|
snapctl/config/hashes.py,sha256=tb0ilslgYvI8L4IKeiMfz2qYRDcezat8tg8dPGqlbAU,3093
|
|
12
|
-
snapctl/main.py,sha256=
|
|
12
|
+
snapctl/main.py,sha256=QES1PqGgMWjKVcOdUA8b14KHweiE2iJigxKtaoJfBDw,19147
|
|
13
13
|
snapctl/types/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
14
14
|
snapctl/types/definitions.py,sha256=rkRyTBHzeQtCt_uYObgYvL5txnVq8r_n5g4IUAq2FWc,233
|
|
15
15
|
snapctl/utils/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
16
16
|
snapctl/utils/echo.py,sha256=0nhWYDBQTfZGtl8EK21hJhj0now2rQmCT-yYMCKupy4,584
|
|
17
17
|
snapctl/utils/helper.py,sha256=xasSsg-0DgHT-TWejh2IXW-s9AYntO1D2O6Uy6BQLcE,1381
|
|
18
|
-
snapctl-0.31.
|
|
19
|
-
snapctl-0.31.
|
|
20
|
-
snapctl-0.31.
|
|
21
|
-
snapctl-0.31.
|
|
18
|
+
snapctl-0.31.1.dist-info/METADATA,sha256=cIywFLCBwuCumEUspq8sf4qgNcsAcixFSIph1Wz0fvI,16509
|
|
19
|
+
snapctl-0.31.1.dist-info/WHEEL,sha256=FMvqSimYX_P7y0a7UY-_Mc83r5zkBZsCYPm7Lr0Bsq4,88
|
|
20
|
+
snapctl-0.31.1.dist-info/entry_points.txt,sha256=tkKW9MzmFdRs6Bgkv29G78i9WEBK4WIOWunPfe3t2Wg,44
|
|
21
|
+
snapctl-0.31.1.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|