Skip to content

Commit

Permalink
Refactor models to include LastModified property
Browse files Browse the repository at this point in the history
  • Loading branch information
Kimmo Forss committed Sep 11, 2024
2 parents 22b57c1 + 04a84b6 commit b9d9b4b
Show file tree
Hide file tree
Showing 49 changed files with 647 additions and 318 deletions.
15 changes: 12 additions & 3 deletions Webapp/SDAF/Controllers/LandscapeController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,9 @@ public async Task<IActionResult> CreateAsync(LandscapeModel landscape)
await UnsetDefault(landscape.Id);
}
landscape.Id = Helper.GenerateId(landscape);
DateTime currentDateAndTime = DateTime.Now;
landscape.LastModified = currentDateAndTime.ToShortDateString();

await _landscapeService.CreateAsync(new LandscapeEntity(landscape));
TempData["success"] = "Successfully created workload zone " + landscape.Id;
string id = landscape.Id;
Expand Down Expand Up @@ -220,7 +223,7 @@ public async Task<IActionResult> DeployAsync(string id, string partitionKey)

List<SelectListItem> environments = restHelper.GetEnvironmentsList().Result;
ViewBag.Environments = environments;


return View(landscapeView);
}
Expand Down Expand Up @@ -351,14 +354,17 @@ public async Task<IActionResult> EditAsync(LandscapeModel landscape)

await _landscapeService.CreateTFVarsAsync(file);

return RedirectToAction("Edit", "Landscape", new { @id = landscape.Id, @partitionKey = landscape.environment }); //RedirectToAction("Index");
return RedirectToAction("Edit", "Landscape", new { @id = landscape.Id, @partitionKey = landscape.environment }); //RedirectToAction("Index");
}
else
{
if (landscape.IsDefault)
{
await UnsetDefault(landscape.Id);
}
DateTime currentDateAndTime = DateTime.Now;
landscape.LastModified = currentDateAndTime.ToShortDateString();

await _landscapeService.UpdateAsync(new LandscapeEntity(landscape));
TempData["success"] = "Successfully updated workload zone " + landscape.Id;

Expand All @@ -378,7 +384,7 @@ public async Task<IActionResult> EditAsync(LandscapeModel landscape)

await _landscapeService.CreateTFVarsAsync(file);

return RedirectToAction("Edit", "Landscape", new { @id = landscape.Id, @partitionKey = landscape.environment }); //RedirectToAction("Index");
return RedirectToAction("Edit", "Landscape", new { @id = landscape.Id, @partitionKey = landscape.environment }); //RedirectToAction("Index");
}
}
catch (Exception e)
Expand Down Expand Up @@ -408,6 +414,9 @@ public async Task<IActionResult> SubmitNewAsync(LandscapeModel landscape)
await UnsetDefault(landscape.Id);
}
landscape.Id = Helper.GenerateId(landscape);
DateTime currentDateAndTime = DateTime.Now;
landscape.LastModified = currentDateAndTime.ToShortDateString();

await _landscapeService.CreateAsync(new LandscapeEntity(landscape));
TempData["success"] = "Successfully created workload zone " + landscape.Id;
string id = landscape.Id;
Expand Down
8 changes: 8 additions & 0 deletions Webapp/SDAF/Controllers/SystemController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,8 @@ public async Task<IActionResult> CreateAsync(SystemModel system)
await UnsetDefault(system.Id);
}
system.Id = Helper.GenerateId(system);
DateTime currentDateAndTime = DateTime.Now;
system.LastModified = currentDateAndTime.ToShortDateString();
SystemEntity systemEntity = new(system);
await _systemService.CreateAsync(systemEntity);
TempData["success"] = "Successfully created system " + system.Id;
Expand Down Expand Up @@ -479,7 +481,10 @@ public async Task<IActionResult> EditAsync(SystemModel system)
system.Description = system.database_platform + " distributed system on " + system.scs_server_image.publisher + " " + system.scs_server_image.offer + " " + system.scs_server_image.sku;
}
}
DateTime currentDateAndTime = DateTime.Now;
system.LastModified = currentDateAndTime.ToShortDateString();
await _systemService.UpdateAsync(new SystemEntity(system));

TempData["success"] = "Successfully updated system " + system.Id;
string id = system.Id;
string path = $"/SYSTEM/{id}/{id}.tfvars";
Expand Down Expand Up @@ -527,6 +532,9 @@ public async Task<IActionResult> SubmitNewAsync(SystemModel system)
await UnsetDefault(system.Id);
}
system.Id = Helper.GenerateId(system);
DateTime currentDateAndTime = DateTime.Now;
system.LastModified = currentDateAndTime.ToShortDateString();

await _systemService.CreateAsync(new SystemEntity(system));
TempData["success"] = "Successfully created system " + system.Id;
return RedirectToAction("Index");
Expand Down
4 changes: 3 additions & 1 deletion Webapp/SDAF/Models/EnvironmentModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ public class Variables
public Variable ARM_TENANT_ID { get; set; }
public Variable sap_fqdn { get; set; }
public Variable POOL { get; set; }

public Variable Use_MSI { get; set; }
public Variable Terraform_Remote_Storage_Account_Name { get; set; }

public Variable Terraform_Remote_Storage_Subscription { get; set; }
Expand All @@ -40,7 +42,7 @@ public class Variables

public class Variable
{
public string value { get; set; }
public string? value { get; set; }
[JsonIgnore]
public bool? isSecret { get; set; }
[JsonIgnore]
Expand Down
2 changes: 2 additions & 0 deletions Webapp/SDAF/Models/LandscapeModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ public bool IsValid()
[DisplayName("Workload zone ID")]
public string Id { get; set; }

public string LastModified { get; set; }

// BASIC

public bool IsDefault { get; set; } = false;
Expand Down
1 change: 1 addition & 0 deletions Webapp/SDAF/Models/SystemModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ public bool IsValid()

[DisplayName("System ID")]
public string Id { get; set; }
public string LastModified { get; set; }

// BASIC

Expand Down
9 changes: 9 additions & 0 deletions Webapp/SDAF/ParameterDetails/LandscapeDetails.json
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,15 @@
"Overrules": "",
"Display": 1
},
{
"Name": "LastModified",
"Required": false,
"Description": "System definition was modified on.",
"Type": "textbox",
"Options": [],
"Overrules": "",
"Display": 1
},
{
"Name": "save_naming_information",
"Required": false,
Expand Down
9 changes: 9 additions & 0 deletions Webapp/SDAF/ParameterDetails/SystemDetails.json
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,15 @@
"Overrules": "",
"Display": 1
},
{
"Name": "LastModified",
"Required": false,
"Description": "System definition was modified on.",
"Type": "textbox",
"Options": [],
"Overrules": "",
"Display": 1
},
{
"Name": "network_logical_name",
"Required": true,
Expand Down
2 changes: 1 addition & 1 deletion Webapp/SDAF/SDAFWebApp.csproj.user
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,6 @@
<WebStackScaffolding_IsLayoutPageSelected>True</WebStackScaffolding_IsLayoutPageSelected>
<WebStackScaffolding_IsPartialViewSelected>False</WebStackScaffolding_IsPartialViewSelected>
<WebStackScaffolding_IsReferencingScriptLibrariesSelected>True</WebStackScaffolding_IsReferencingScriptLibrariesSelected>
<NameOfLastUsedPublishProfile>C:\Work\Repos\sap-automation\Webapp\SDAF\Properties\PublishProfiles\cpln-noeu-sapdeployment597 - Web Deploy1.pubxml</NameOfLastUsedPublishProfile>
<NameOfLastUsedPublishProfile>cpln-noeu-sapdeployment597 - Web Deploy1</NameOfLastUsedPublishProfile>
</PropertyGroup>
</Project>
4 changes: 2 additions & 2 deletions Webapp/SDAF/Views/System/Edit.cshtml
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@
</div>
</div>
}

<div id="form-sticky-header">
<div class="filter-checkboxes">
<fluent-checkbox checked class="parameters-filter" onchange="toggleParams(this, 1)" id="basic-filter">Basic</fluent-checkbox>
Expand Down Expand Up @@ -145,7 +145,7 @@
</td>

</tr>


</form>
</div>
14 changes: 9 additions & 5 deletions Webapp/SDAF/Views/System/Install.cshtml
Original file line number Diff line number Diff line change
Expand Up @@ -102,17 +102,21 @@

@Html.EditorForModel("Checkbox", new { ParameterName = "database_install", DisplayName = "Database Installation", IsChecked = true })

@Html.EditorForModel("Checkbox", new { ParameterName = "scs_installation", DisplayName = "SCS Installation", IsChecked = true })
@Html.EditorForModel("Checkbox", new { ParameterName = "scs_installation", DisplayName = "SCS Installation & High Availability Configuration", IsChecked = true })

@Html.EditorForModel("Checkbox", new { ParameterName = "db_load", DisplayName = "Database Load", IsChecked = true })

@Html.EditorForModel("Checkbox", new { ParameterName = "high_availability_configuration", DisplayName = "SAP & DB High Availability Setup", IsChecked = true })
@Html.EditorForModel("Checkbox", new { ParameterName = "high_availability_configuration", DisplayName = "Database High Availability Configuration", IsChecked = true })

@Html.EditorForModel("Checkbox", new { ParameterName = "pas_installation", DisplayName = "PAS Installation", IsChecked = true })
@Html.EditorForModel("Checkbox", new { ParameterName = "pas_installation", DisplayName = "Primary Application Server Installation", IsChecked = true })

@Html.EditorForModel("Checkbox", new { ParameterName = "application_server_installation", DisplayName = "APP Installation", IsChecked = true })
@Html.EditorForModel("Checkbox", new { ParameterName = "application_server_installation", DisplayName = "Application Server Installation", IsChecked = true })

@Html.EditorForModel("Checkbox", new { ParameterName = "webdispatcher_installation", DisplayName = "WebDispatcher Installation", IsChecked = false })
@Html.EditorForModel("Checkbox", new { ParameterName = "webdispatcher_installation", DisplayName = "Web Dispatcher Installation", IsChecked = false })

@Html.EditorForModel("Checkbox", new { ParameterName = "post_configuration_actions", DisplayName = "Post Configuration Actions", IsChecked = false })

@Html.EditorForModel("Checkbox", new { ParameterName = "ams_provider", DisplayName = "Configure AMS Provider", IsChecked = false })

@Html.EditorForModel("Checkbox", new { ParameterName = "acss_registration", DisplayName = "Register System in ACSS", IsChecked = true })

Expand Down
3 changes: 1 addition & 2 deletions deploy/ansible/playbook_01_os_base_config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -80,8 +80,7 @@

- name: "OS configuration playbook: - Set deployment type"
ansible.builtin.set_fact:
single_server: true
when: (ansible_play_hosts_all | length) == 1
single_server: "{{ (ansible_play_hosts_all | length) == 1 }}"
tags:
- always

Expand Down
3 changes: 1 addition & 2 deletions deploy/ansible/playbook_02_os_sap_specific_config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -83,8 +83,7 @@

- name: "SAP OS Configuration: - Set deployment type"
ansible.builtin.set_fact:
single_server: true
when: (ansible_play_hosts_all | length) == 1
single_server: "{{ (ansible_play_hosts_all | length) == 1 }}"
tags:
- always

Expand Down
3 changes: 3 additions & 0 deletions deploy/ansible/playbook_04_00_00_db_install.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -361,6 +361,9 @@
- name: "Database Installation Playbook: - Clear the failed state of hosts"
ansible.builtin.meta: clear_host_errors

- name: "Database Installation Playbook: - Clear the failed state of hosts"
ansible.builtin.meta: clear_host_errors

# - name: "Database installation Playbook: - run HANA Scale-Out mounts"
# ansible.builtin.include_role:
# name: roles-sap-os/2.6-sap-mounts
Expand Down
3 changes: 1 addition & 2 deletions deploy/ansible/playbook_05_01_sap_dbload.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -93,8 +93,7 @@

- name: "DBLoad Playbook: - Set deployment type"
ansible.builtin.set_fact:
single_server: true
when: (ansible_play_hosts_all | length) == 1
single_server: "{{ (ansible_play_hosts_all | length) == 1 }}"
tags:
- always

Expand Down
3 changes: 1 addition & 2 deletions deploy/ansible/playbook_05_02_sap_pas_install.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -158,8 +158,7 @@

- name: "PAS Installation Playbook: - Set deployment type"
ansible.builtin.set_fact:
single_server: true
when: (ansible_play_hosts_all | length) == 1
single_server: "{{ (ansible_play_hosts_all | length) == 1 }}"
tags:
- always

Expand Down
3 changes: 1 addition & 2 deletions deploy/ansible/playbook_05_03_sap_app_install.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -98,8 +98,7 @@

- name: "APP Installation Playbook: - Set deployment type"
ansible.builtin.set_fact:
single_server: true
when: (ansible_play_hosts_all | length) == 1
single_server: "{{ (ansible_play_hosts_all | length) == 1 }}"
tags:
- always

Expand Down
23 changes: 21 additions & 2 deletions deploy/ansible/playbook_06_00_acss_registration.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,26 @@
tags:
- 0.1-passwords

- name: "0.0 Validations - Get Access Token"
ansible.builtin.command: >-
az account get-access-token --query accessToken -o tsv
changed_when: false
register: access_token_data
no_log: true
tags:
- always

- name: "0.0 Validations - Save the access token"
ansible.builtin.set_fact:
access_token: "{{ access_token_data.stdout }}"
no_log: true
tags:
- always


# /*---------------------------------------------------------------------------8
# | |
# | Playbook for SAP Web Dispatcher Install |
# | Playbook for ASCS Registration |
# | |
# +------------------------------------4--------------------------------------*/

Expand All @@ -54,7 +71,6 @@

name: ACSS Registration
remote_user: "{{ orchestration_ansible_user }}"
become: true
gather_facts: true # Important to collect hostvars information
vars_files:
- vars/ansible-input-api.yaml # API Input template with defaults
Expand Down Expand Up @@ -87,11 +103,14 @@
when:
- acssEnvironment is defined
- acssSapProduct is defined
- ansible_os_family != "Windows"
ansible.builtin.include_role:
name: "roles-misc/0.5-ACSS-registration"
vars:
acss_environment: "{{ acssEnvironment }}"
acss_sap_product: "{{ acssSapProduct }}"
acss_access_token: "{{ hostvars.localhost.access_token }}"
acss_guid: "{{ ansible_hostname | to_uuid }}"
loop: "{{ all_sids }}"
loop_control:
loop_var: sid_to_be_deployed
Expand Down
Loading

0 comments on commit b9d9b4b

Please sign in to comment.