determineIsTenanted returns true if we are going to do a tenanted deployment, false if untenanted NOTE: Tenant can be disabled or forced. In these cases we know what to do. The middle case is "allowed, but not forced", in which case we don't know ahead of time what to do WRT tenants, so we'd need to
(project *projects.Project, ask question.Asker)
| 1098 | // We COULD do a little bit of a shortcut; if tenant is 'allowed but not required' but the project has no |
| 1099 | // linked tenants, then it can't be tenanted, but is this worth the extra complexity? Decision: no |
| 1100 | func determineIsTenanted(project *projects.Project, ask question.Asker) (bool, error) { |
| 1101 | switch project.TenantedDeploymentMode { |
| 1102 | case core.TenantedDeploymentModeUntenanted: |
| 1103 | return false, nil |
| 1104 | case core.TenantedDeploymentModeTenanted: |
| 1105 | return true, nil |
| 1106 | case core.TenantedDeploymentModeTenantedOrUntenanted: |
| 1107 | return question.SelectMap(ask, "Select Tenanted or Untenanted deployment", []bool{true, false}, func(b bool) string { |
| 1108 | if b { |
| 1109 | return "Tenanted" // should be the default; they probably want tenanted |
| 1110 | } else { |
| 1111 | return "Untenanted" |
| 1112 | } |
| 1113 | }) |
| 1114 | |
| 1115 | default: // should not get here |
| 1116 | return false, fmt.Errorf("unhandled tenanted deployment mode %s", project.TenantedDeploymentMode) |
| 1117 | } |
| 1118 | } |
no test coverage detected