Skip to content

Commit

Permalink
[backend] add elevation_required into paylaod model
Browse files Browse the repository at this point in the history
  • Loading branch information
savacano28 committed Sep 11, 2024
1 parent 64da7e5 commit ad3a556
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ public String getFileOrDownloadFromJfrog(String platform, String file, String ad
String filename = file + "-" + version + "." + extension;
String resourcePath = "/openbas-agent/" + platform.toLowerCase() + "/";
InputStream in = getClass().getResourceAsStream("/agents" + resourcePath + filename);
if (null == in) { // Dev mode, get from artifactory
if (in == null) { // Dev mode, get from artifactory
filename = file + "-latest." + extension;
in = new BufferedInputStream(new URL(JFROG_BASE + resourcePath + filename).openStream());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,15 +27,15 @@ private String computeCommand(@NotNull final Inject inject, Endpoint.PLATFORM_TY
.orElseThrow(() -> new UnsupportedOperationException("Inject does not have a contract"));

switch (platform) {
case Windows -> {
case Endpoint.PLATFORM_TYPE.Windows -> {
return injector.getExecutorCommands().get(Endpoint.PLATFORM_TYPE.Windows.name() + "." + arch.name())
.replace("#{inject}", inject.getId());
}
case Linux -> {
case Endpoint.PLATFORM_TYPE.Linux -> {
return injector.getExecutorCommands().get(Endpoint.PLATFORM_TYPE.Linux.name() + "." + arch.name())
.replace("#{inject}", inject.getId());
}
case MacOS -> {
case Endpoint.PLATFORM_TYPE.MacOS -> {
return injector.getExecutorCommands().get(Endpoint.PLATFORM_TYPE.MacOS.name() + "." + arch.name())
.replace("#{inject}", inject.getId());
}
Expand All @@ -46,7 +46,7 @@ private String computeCommand(@NotNull final Inject inject, Endpoint.PLATFORM_TY
public void launchExecutorSubprocess(@NotNull final Inject inject, @NotNull final Asset asset) {
Endpoint.PLATFORM_TYPE platform = Objects.equals(asset.getType(), "Endpoint") ? ((Endpoint) Hibernate.unproxy(asset)).getPlatform() : null;
Endpoint.PLATFORM_ARCH arch = Objects.equals(asset.getType(), "Endpoint") ? ((Endpoint) Hibernate.unproxy(asset)).getArch() : null;
if (null == platform) {
if (platform == null) {
throw new RuntimeException("Unsupported null platform");
}
AssetAgentJob assetAgentJob = new AssetAgentJob();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,24 +48,24 @@ public class AssetAgentJob implements Base {

@Override
public String toString() {
return this.id;
return id;
}

@Override
public boolean equals(final Object o) {
public boolean equals(Object o) {
if (this == o) return true;
if (null == o || !Base.class.isAssignableFrom(o.getClass())) return false;
final Base base = (Base) o;
return this.id.equals(base.getId());
if (o == null || !Base.class.isAssignableFrom(o.getClass())) return false;
Base base = (Base) o;
return id.equals(base.getId());
}

@Override
public int hashCode() {
return Objects.hash(this.id);
return Objects.hash(id);
}

@Override
public String getId() {
return this.id;
return id;
}
}

0 comments on commit ad3a556

Please sign in to comment.