ominfra 0.0.0.dev174__py3-none-any.whl → 0.0.0.dev175__py3-none-any.whl

Sign up to get free protection for your applications and to get access to all the features.
@@ -24,13 +24,12 @@ from omlish.os.paths import is_path_in_dir
24
24
  from omlish.os.paths import relative_symlink
25
25
 
26
26
  from .paths.paths import DeployPath
27
- from .specs import AllActiveDeployAppConfLink
28
- from .specs import CurrentOnlyDeployAppConfLink
29
27
  from .specs import DeployAppConfFile
30
28
  from .specs import DeployAppConfLink
31
29
  from .specs import DeployAppConfSpec
32
30
  from .tags import DEPLOY_TAG_SEPARATOR
33
31
  from .tags import DeployApp
32
+ from .tags import DeployConf
34
33
  from .tags import DeployTagMap
35
34
  from .types import DeployHome
36
35
 
@@ -63,6 +62,7 @@ class DeployConfManager:
63
62
  #
64
63
 
65
64
  class _ComputedConfLink(ta.NamedTuple):
65
+ conf: DeployConf
66
66
  is_dir: bool
67
67
  link_src: str
68
68
  link_dst: str
@@ -70,8 +70,9 @@ class DeployConfManager:
70
70
  _UNIQUE_LINK_NAME_STR = '@app--@time--@app-key'
71
71
  _UNIQUE_LINK_NAME = DeployPath.parse(_UNIQUE_LINK_NAME_STR)
72
72
 
73
+ @classmethod
73
74
  def _compute_app_conf_link_dst(
74
- self,
75
+ cls,
75
76
  link: DeployAppConfLink,
76
77
  tags: DeployTagMap,
77
78
  app_conf_dir: str,
@@ -85,6 +86,7 @@ class DeployConfManager:
85
86
  if (is_dir := link.src.endswith('/')):
86
87
  # @conf/ - links a directory in root of app conf dir to conf/@conf/@dst/
87
88
  check.arg(link.src.count('/') == 1)
89
+ conf = DeployConf(link.src.split('/')[0])
88
90
  link_dst_pfx = link.src
89
91
  link_dst_sfx = ''
90
92
 
@@ -92,6 +94,7 @@ class DeployConfManager:
92
94
  # @conf/file - links a single file in a single subdir to conf/@conf/@dst--file
93
95
  d, f = os.path.split(link.src)
94
96
  # TODO: check filename :|
97
+ conf = DeployConf(d)
95
98
  link_dst_pfx = d + '/'
96
99
  link_dst_sfx = DEPLOY_TAG_SEPARATOR + f
97
100
 
@@ -99,18 +102,20 @@ class DeployConfManager:
99
102
  # @conf(.ext)* - links a single file in root of app conf dir to conf/@conf/@dst(.ext)*
100
103
  if '.' in link.src:
101
104
  l, _, r = link.src.partition('.')
105
+ conf = DeployConf(l)
102
106
  link_dst_pfx = l + '/'
103
107
  link_dst_sfx = '.' + r
104
108
  else:
109
+ conf = DeployConf(link.src)
105
110
  link_dst_pfx = link.src + '/'
106
111
  link_dst_sfx = ''
107
112
 
108
113
  #
109
114
 
110
- if isinstance(link, CurrentOnlyDeployAppConfLink):
115
+ if link.kind == 'current_only':
111
116
  link_dst_mid = str(tags[DeployApp].s)
112
- elif isinstance(link, AllActiveDeployAppConfLink):
113
- link_dst_mid = self._UNIQUE_LINK_NAME.render(tags)
117
+ elif link.kind == 'all_active':
118
+ link_dst_mid = cls._UNIQUE_LINK_NAME.render(tags)
114
119
  else:
115
120
  raise TypeError(link)
116
121
 
@@ -124,6 +129,7 @@ class DeployConfManager:
124
129
  link_dst = os.path.join(conf_link_dir, link_dst_name)
125
130
 
126
131
  return DeployConfManager._ComputedConfLink(
132
+ conf=conf,
127
133
  is_dir=is_dir,
128
134
  link_src=link_src,
129
135
  link_dst=link_dst,
@@ -170,7 +170,7 @@ class FileDeployPathPart(DeployPathPart):
170
170
  return 'file'
171
171
 
172
172
 
173
- #
173
+ ##
174
174
 
175
175
 
176
176
  @dc.dataclass(frozen=True)
@@ -197,7 +197,7 @@ class DeployPath:
197
197
  return pd
198
198
 
199
199
  @property
200
- def kind(self) -> ta.Literal['file', 'dir']:
200
+ def kind(self) -> DeployPathKind:
201
201
  return self.parts[-1].kind
202
202
 
203
203
  def render(self, tags: ta.Optional[DeployTagMap] = None) -> str:
@@ -95,7 +95,7 @@ class DeployAppConfFile:
95
95
 
96
96
 
97
97
  @dc.dataclass(frozen=True)
98
- class DeployAppConfLink(abc.ABC): # noqa
98
+ class DeployAppConfLink: # noqa
99
99
  """
100
100
  May be either:
101
101
  - @conf(.ext)* - links a single file in root of app conf dir to conf/@conf/@dst(.ext)*
@@ -105,20 +105,14 @@ class DeployAppConfLink(abc.ABC): # noqa
105
105
 
106
106
  src: str
107
107
 
108
+ kind: ta.Literal['current_only', 'all_active'] = 'current_only'
109
+
108
110
  def __post_init__(self) -> None:
109
111
  check_valid_deploy_spec_path(self.src)
110
112
  if '/' in self.src:
111
113
  check.equal(self.src.count('/'), 1)
112
114
 
113
115
 
114
- class CurrentOnlyDeployAppConfLink(DeployAppConfLink):
115
- pass
116
-
117
-
118
- class AllActiveDeployAppConfLink(DeployAppConfLink):
119
- pass
120
-
121
-
122
116
  #
123
117
 
124
118
 
ominfra/scripts/manage.py CHANGED
@@ -7084,7 +7084,7 @@ class FileDeployPathPart(DeployPathPart):
7084
7084
  return 'file'
7085
7085
 
7086
7086
 
7087
- #
7087
+ ##
7088
7088
 
7089
7089
 
7090
7090
  @dc.dataclass(frozen=True)
@@ -7111,7 +7111,7 @@ class DeployPath:
7111
7111
  return pd
7112
7112
 
7113
7113
  @property
7114
- def kind(self) -> ta.Literal['file', 'dir']:
7114
+ def kind(self) -> DeployPathKind:
7115
7115
  return self.parts[-1].kind
7116
7116
 
7117
7117
  def render(self, tags: ta.Optional[DeployTagMap] = None) -> str:
@@ -7206,7 +7206,7 @@ class DeployAppConfFile:
7206
7206
 
7207
7207
 
7208
7208
  @dc.dataclass(frozen=True)
7209
- class DeployAppConfLink(abc.ABC): # noqa
7209
+ class DeployAppConfLink: # noqa
7210
7210
  """
7211
7211
  May be either:
7212
7212
  - @conf(.ext)* - links a single file in root of app conf dir to conf/@conf/@dst(.ext)*
@@ -7216,20 +7216,14 @@ class DeployAppConfLink(abc.ABC): # noqa
7216
7216
 
7217
7217
  src: str
7218
7218
 
7219
+ kind: ta.Literal['current_only', 'all_active'] = 'current_only'
7220
+
7219
7221
  def __post_init__(self) -> None:
7220
7222
  check_valid_deploy_spec_path(self.src)
7221
7223
  if '/' in self.src:
7222
7224
  check.equal(self.src.count('/'), 1)
7223
7225
 
7224
7226
 
7225
- class CurrentOnlyDeployAppConfLink(DeployAppConfLink):
7226
- pass
7227
-
7228
-
7229
- class AllActiveDeployAppConfLink(DeployAppConfLink):
7230
- pass
7231
-
7232
-
7233
7227
  #
7234
7228
 
7235
7229
 
@@ -7917,6 +7911,7 @@ class DeployConfManager:
7917
7911
  #
7918
7912
 
7919
7913
  class _ComputedConfLink(ta.NamedTuple):
7914
+ conf: DeployConf
7920
7915
  is_dir: bool
7921
7916
  link_src: str
7922
7917
  link_dst: str
@@ -7924,8 +7919,9 @@ class DeployConfManager:
7924
7919
  _UNIQUE_LINK_NAME_STR = '@app--@time--@app-key'
7925
7920
  _UNIQUE_LINK_NAME = DeployPath.parse(_UNIQUE_LINK_NAME_STR)
7926
7921
 
7922
+ @classmethod
7927
7923
  def _compute_app_conf_link_dst(
7928
- self,
7924
+ cls,
7929
7925
  link: DeployAppConfLink,
7930
7926
  tags: DeployTagMap,
7931
7927
  app_conf_dir: str,
@@ -7939,6 +7935,7 @@ class DeployConfManager:
7939
7935
  if (is_dir := link.src.endswith('/')):
7940
7936
  # @conf/ - links a directory in root of app conf dir to conf/@conf/@dst/
7941
7937
  check.arg(link.src.count('/') == 1)
7938
+ conf = DeployConf(link.src.split('/')[0])
7942
7939
  link_dst_pfx = link.src
7943
7940
  link_dst_sfx = ''
7944
7941
 
@@ -7946,6 +7943,7 @@ class DeployConfManager:
7946
7943
  # @conf/file - links a single file in a single subdir to conf/@conf/@dst--file
7947
7944
  d, f = os.path.split(link.src)
7948
7945
  # TODO: check filename :|
7946
+ conf = DeployConf(d)
7949
7947
  link_dst_pfx = d + '/'
7950
7948
  link_dst_sfx = DEPLOY_TAG_SEPARATOR + f
7951
7949
 
@@ -7953,18 +7951,20 @@ class DeployConfManager:
7953
7951
  # @conf(.ext)* - links a single file in root of app conf dir to conf/@conf/@dst(.ext)*
7954
7952
  if '.' in link.src:
7955
7953
  l, _, r = link.src.partition('.')
7954
+ conf = DeployConf(l)
7956
7955
  link_dst_pfx = l + '/'
7957
7956
  link_dst_sfx = '.' + r
7958
7957
  else:
7958
+ conf = DeployConf(link.src)
7959
7959
  link_dst_pfx = link.src + '/'
7960
7960
  link_dst_sfx = ''
7961
7961
 
7962
7962
  #
7963
7963
 
7964
- if isinstance(link, CurrentOnlyDeployAppConfLink):
7964
+ if link.kind == 'current_only':
7965
7965
  link_dst_mid = str(tags[DeployApp].s)
7966
- elif isinstance(link, AllActiveDeployAppConfLink):
7967
- link_dst_mid = self._UNIQUE_LINK_NAME.render(tags)
7966
+ elif link.kind == 'all_active':
7967
+ link_dst_mid = cls._UNIQUE_LINK_NAME.render(tags)
7968
7968
  else:
7969
7969
  raise TypeError(link)
7970
7970
 
@@ -7978,6 +7978,7 @@ class DeployConfManager:
7978
7978
  link_dst = os.path.join(conf_link_dir, link_dst_name)
7979
7979
 
7980
7980
  return DeployConfManager._ComputedConfLink(
7981
+ conf=conf,
7981
7982
  is_dir=is_dir,
7982
7983
  link_src=link_src,
7983
7984
  link_dst=link_dst,
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: ominfra
3
- Version: 0.0.0.dev174
3
+ Version: 0.0.0.dev175
4
4
  Summary: ominfra
5
5
  Author: wrmsr
6
6
  License: BSD-3-Clause
@@ -12,8 +12,8 @@ Classifier: Operating System :: OS Independent
12
12
  Classifier: Operating System :: POSIX
13
13
  Requires-Python: >=3.12
14
14
  License-File: LICENSE
15
- Requires-Dist: omdev==0.0.0.dev174
16
- Requires-Dist: omlish==0.0.0.dev174
15
+ Requires-Dist: omdev==0.0.0.dev175
16
+ Requires-Dist: omlish==0.0.0.dev175
17
17
  Provides-Extra: all
18
18
  Requires-Dist: paramiko~=3.5; extra == "all"
19
19
  Requires-Dist: asyncssh~=2.18; extra == "all"
@@ -46,13 +46,13 @@ ominfra/manage/commands/types.py,sha256=XFZPeqeIBAaIIQF3pdPbGxLlb-LCrz6WtlDWO2q_
46
46
  ominfra/manage/deploy/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
47
47
  ominfra/manage/deploy/apps.py,sha256=4qcUi7Zxd2Sgfb8ZQSbjiMv1ppkHpJ37zJJMeDs6_xo,4738
48
48
  ominfra/manage/deploy/commands.py,sha256=fKFKhFwqIqC_PsgA-W66qIJ5S32xRgBBaRt3lbPX5Zg,763
49
- ominfra/manage/deploy/conf.py,sha256=C2eLMuB2BVi7RM-7aPvZvlZbAgQVDunDD0AehJ11Kog,5511
49
+ ominfra/manage/deploy/conf.py,sha256=cGu9q-mtbBsBXydTGrNE11NGyYdxbn7aPiGx28rxhsg,5639
50
50
  ominfra/manage/deploy/config.py,sha256=aR6ubMEWqkTI55XtcG1Cczn6YhCVN6eSL8DT5EHQJN0,166
51
51
  ominfra/manage/deploy/deploy.py,sha256=zEcuwH7Sj3Z5Wb5U9RDqEG8CHaOZVhGpPBBTGGER2j4,1672
52
52
  ominfra/manage/deploy/git.py,sha256=cfTCx1qD-FQPFkbYW28tkU8nVxQbnfnWxpuJuGQHtBw,3753
53
53
  ominfra/manage/deploy/inject.py,sha256=kzGl2N2jhijUw4-PYUK1LNG8_MJD7BMgCbi6nDViMWg,1965
54
54
  ominfra/manage/deploy/interp.py,sha256=OKkenH8YKEW_mEDR6X7_ZLxK9a1Ox6KHSwFPTHT6OzA,1029
55
- ominfra/manage/deploy/specs.py,sha256=13QLTShAyt-tT0i85Cf_L6GsPZvVKnYShk2EMrLBdj8,3726
55
+ ominfra/manage/deploy/specs.py,sha256=XIEOdLwULFprLajjzX6Qf_T3wVvEWeC4tIZgYbycCHI,3656
56
56
  ominfra/manage/deploy/tags.py,sha256=f2gTcV9aOGv5A6-6ZESHzeQ47TcLTkaEXe60_JyvqQo,4977
57
57
  ominfra/manage/deploy/tmp.py,sha256=dFJuqGfSf5otCxSaCI01a5UOSaArMlU4MzzYcyr74-s,1237
58
58
  ominfra/manage/deploy/types.py,sha256=ZcIoheZ3zW7n0IZiqTRW_Uo3JyWWeWg5nyKGryvGc2I,112
@@ -61,7 +61,7 @@ ominfra/manage/deploy/paths/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMp
61
61
  ominfra/manage/deploy/paths/inject.py,sha256=X81C-Qhef1LQ7tILWvkomBwFTvgooLVmWRnKL7TeVoI,596
62
62
  ominfra/manage/deploy/paths/manager.py,sha256=gxr_CsjLmjxXx8w3J8ookJk9OGltCpyBFYBnxXaw5lg,1050
63
63
  ominfra/manage/deploy/paths/owners.py,sha256=GmLy0E70C8CF3eYIdkAhBtYaZXW4QWmSzvgts5l1i_4,1379
64
- ominfra/manage/deploy/paths/paths.py,sha256=_zFXTeiACLkC9i289rQlqkPg_U8nHWWpuShW29-STSs,5541
64
+ ominfra/manage/deploy/paths/paths.py,sha256=i7g8YdYOh4M_jgJXtafTbFkRhlu469cfGxAJAuB3fVY,5531
65
65
  ominfra/manage/deploy/paths/types.py,sha256=TGgtSASmdyuZ2maZnvahfA0QxPLWlHBtpDeIEoEDGxk,112
66
66
  ominfra/manage/remote/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
67
67
  ominfra/manage/remote/_main.py,sha256=p5KoiS2WMw6QAqlDl_Zun-JybmCsy8awIfpBMLBjGMY,4356
@@ -86,7 +86,7 @@ ominfra/manage/targets/inject.py,sha256=P4597xWM-V3I_gCt2O71OLhYQkkXtuJvkYRsIbhh
86
86
  ominfra/manage/targets/targets.py,sha256=7GP6UAZyJFEhpkJN6UQdpr_WN3p7C76v-s445y-WB6U,1885
87
87
  ominfra/scripts/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
88
88
  ominfra/scripts/journald2aws.py,sha256=fbs8jZCsnwi5vF8Bg892wu3rscHCHeLQlvsDs6oAZBs,156681
89
- ominfra/scripts/manage.py,sha256=jzClDt2zLKySdtAvo1vvis8bJaYVY44KB_jZ6ePY4ho,316667
89
+ ominfra/scripts/manage.py,sha256=K9Z5QjGH3maQYwRnW3UbvL7dkdAk4-mLwvgWVC8TLSg,316780
90
90
  ominfra/scripts/supervisor.py,sha256=CD8o9RktPyB3L8nMBa6rabWE0tZlti6dmzoEEKRPWvY,275447
91
91
  ominfra/supervisor/LICENSE.txt,sha256=yvqaMNsDhWxziHa9ien6qCW1SkZv-DQlAg96XjfSee8,1746
92
92
  ominfra/supervisor/__init__.py,sha256=Y3l4WY4JRi2uLG6kgbGp93fuGfkxkKwZDvhsa0Rwgtk,15
@@ -129,9 +129,9 @@ ominfra/tailscale/api.py,sha256=C5-t_b6jZXUWcy5k8bXm7CFnk73pSdrlMOgGDeGVrpw,1370
129
129
  ominfra/tailscale/cli.py,sha256=h6akQJMl0KuWLHS7Ur6WcBZ2JwF0DJQhsPTnFBdGyNk,3571
130
130
  ominfra/tools/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
131
131
  ominfra/tools/listresources.py,sha256=4qVg5txsb10EHhvqXXeM6gJ2jx9LbroEnPydDv1uXs0,6176
132
- ominfra-0.0.0.dev174.dist-info/LICENSE,sha256=B_hVtavaA8zCYDW99DYdcpDLKz1n3BBRjZrcbv8uG8c,1451
133
- ominfra-0.0.0.dev174.dist-info/METADATA,sha256=qeVp2nf876Zeu0NurT7Qldb4EuRYsIuTY9jAFc51DXo,731
134
- ominfra-0.0.0.dev174.dist-info/WHEEL,sha256=PZUExdf71Ui_so67QXpySuHtCi3-J3wvF4ORK6k_S8U,91
135
- ominfra-0.0.0.dev174.dist-info/entry_points.txt,sha256=kgecQ2MgGrM9qK744BoKS3tMesaC3yjLnl9pa5CRczg,37
136
- ominfra-0.0.0.dev174.dist-info/top_level.txt,sha256=E-b2OHkk_AOBLXHYZQ2EOFKl-_6uOGd8EjeG-Zy6h_w,8
137
- ominfra-0.0.0.dev174.dist-info/RECORD,,
132
+ ominfra-0.0.0.dev175.dist-info/LICENSE,sha256=B_hVtavaA8zCYDW99DYdcpDLKz1n3BBRjZrcbv8uG8c,1451
133
+ ominfra-0.0.0.dev175.dist-info/METADATA,sha256=mSx5m3-8qdibsCJFkrdMM2Z7H2DonPWOBSnJFlETz2M,731
134
+ ominfra-0.0.0.dev175.dist-info/WHEEL,sha256=PZUExdf71Ui_so67QXpySuHtCi3-J3wvF4ORK6k_S8U,91
135
+ ominfra-0.0.0.dev175.dist-info/entry_points.txt,sha256=kgecQ2MgGrM9qK744BoKS3tMesaC3yjLnl9pa5CRczg,37
136
+ ominfra-0.0.0.dev175.dist-info/top_level.txt,sha256=E-b2OHkk_AOBLXHYZQ2EOFKl-_6uOGd8EjeG-Zy6h_w,8
137
+ ominfra-0.0.0.dev175.dist-info/RECORD,,