Skip to content

Commit 4444b40

Browse files
Fixed bug disabling fetching from git
1 parent 0f24a8b commit 4444b40

File tree

2 files changed

+22
-18
lines changed

2 files changed

+22
-18
lines changed

src/phoebus_guibuilder/git_utilities.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ def get_yaml(self, url) -> str | None:
3434
config_json: dict | None = self.get_json_from_url(url)
3535
assert config_json is not None, "Could not fetch config json tree"
3636

37-
ioc_yaml_url = self.fetch_matches(config_json, "ioc_yaml")
37+
ioc_yaml_url = self.fetch_matches(config_json, "iocyaml")
3838
if ioc_yaml_url is not None:
3939
data: dict | None = self.get_json_from_url(ioc_yaml_url)
4040
if data is not None:
@@ -81,6 +81,7 @@ def fetch_matches(self, tree: dict, task: str) -> str | None:
8181
for item in tree
8282
if isinstance(item, dict) and item.get("path") == "config"
8383
]
84+
print(f"DEBUG2:{config[0]['url']}")
8485
return config[0]["url"]
8586
elif task == "iocyaml":
8687
tree = tree["tree"]
@@ -89,6 +90,7 @@ def fetch_matches(self, tree: dict, task: str) -> str | None:
8990
for item in tree
9091
if isinstance(item, dict) and item.get("path") == "ioc.yaml"
9192
]
93+
print(f"DEBUG3:{ioc_url[0]['url']}")
9294
return ioc_url[0]["url"]
9395

9496
def fetch_ioc_yaml(

src/phoebus_guibuilder/guibuilder.py

Lines changed: 19 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
import io
2+
13
import yaml
24

35
from phoebus_guibuilder.datatypes import Beamline, Component, Entry
@@ -67,24 +69,24 @@ def extract_valid_entities(self, ioc_yaml: str, component: Component):
6769
entities: list[dict[str, str]] = []
6870
component_match = f"{component.P}:{component.R}"
6971

70-
with open(ioc_yaml) as ioc:
71-
conf = yaml.safe_load(ioc)
72-
entities = conf["entities"]
73-
print(entities)
74-
for entity in entities:
75-
if (
76-
"P" in entity.keys() and entity["P"] == component_match
77-
): # the suffix could be M, could be R
78-
self.valid_entities.append(
79-
Entry(
80-
type=entity["type"],
81-
DESC=None,
82-
P=entity["P"],
83-
M=None,
84-
R=None,
85-
)
72+
ioc = io.StringIO(ioc_yaml)
73+
conf = yaml.safe_load(ioc)
74+
entities = conf["entities"]
75+
print(entities)
76+
for entity in entities:
77+
if (
78+
"P" in entity.keys() and entity["P"] == component_match
79+
): # the suffix could be M, could be R
80+
self.valid_entities.append(
81+
Entry(
82+
type=entity["type"],
83+
DESC=None,
84+
P=entity["P"],
85+
M=None,
86+
R=None,
8687
)
87-
print(self.valid_entities)
88+
)
89+
print(self.valid_entities)
8890

8991
def gui_map(self, entrys: list[Entry]):
9092
"""

0 commit comments

Comments
 (0)