V2 Wizard: Fix snapshot_date field
The snapshot_date in the image_request must be a date. snapshot_date is an optional field and if no snapshot is used, the field should be undefined. Previously it was an empty string and this caused image builder to return a code 400 with message "Snapshot date is not in DateOnly (yyyy-mm-dd) format".
This commit is contained in:
parent
7246cfbd16
commit
bb91840eef
6 changed files with 1 additions and 10 deletions
|
|
@ -203,7 +203,7 @@ const getImageRequests = (state: RootState): ImageRequest[] => {
|
|||
type: uploadTypeByTargetEnv(type),
|
||||
options: getImageOptions(type, state),
|
||||
},
|
||||
snapshot_date: useLatest ? '' : snapshotDate,
|
||||
snapshot_date: useLatest ? undefined : snapshotDate,
|
||||
}));
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -79,7 +79,6 @@ describe('registration request generated correctly', () => {
|
|||
const imageRequest: ImageRequest = {
|
||||
architecture: 'x86_64',
|
||||
image_type: 'image-installer',
|
||||
snapshot_date: '',
|
||||
upload_request: {
|
||||
options: {},
|
||||
type: 'aws.s3',
|
||||
|
|
|
|||
|
|
@ -94,7 +94,6 @@ describe('aws image type request generated correctly', () => {
|
|||
const expectedImageRequest: ImageRequest = {
|
||||
architecture: 'x86_64',
|
||||
image_type: 'aws',
|
||||
snapshot_date: '',
|
||||
upload_request: {
|
||||
options: {
|
||||
share_with_sources: ['123'],
|
||||
|
|
@ -121,7 +120,6 @@ describe('aws image type request generated correctly', () => {
|
|||
const expectedImageRequest: ImageRequest = {
|
||||
architecture: 'x86_64',
|
||||
image_type: 'aws',
|
||||
snapshot_date: '',
|
||||
upload_request: {
|
||||
options: {
|
||||
share_with_accounts: ['123123123123'],
|
||||
|
|
|
|||
|
|
@ -121,7 +121,6 @@ describe('azure image type request generated correctly', () => {
|
|||
const expectedImageRequest: ImageRequest = {
|
||||
architecture: 'x86_64',
|
||||
image_type: 'azure',
|
||||
snapshot_date: '',
|
||||
upload_request: {
|
||||
options: {
|
||||
source_id: '666',
|
||||
|
|
@ -152,7 +151,6 @@ describe('azure image type request generated correctly', () => {
|
|||
const expectedImageRequest: ImageRequest = {
|
||||
architecture: 'x86_64',
|
||||
image_type: 'azure',
|
||||
snapshot_date: '',
|
||||
upload_request: {
|
||||
type: 'azure',
|
||||
options: {
|
||||
|
|
|
|||
|
|
@ -41,7 +41,6 @@ const routes = [
|
|||
export const imageRequest: ImageRequest = {
|
||||
architecture: 'x86_64',
|
||||
image_type: 'image-installer',
|
||||
snapshot_date: '',
|
||||
upload_request: {
|
||||
options: {},
|
||||
type: 'aws.s3',
|
||||
|
|
|
|||
3
src/test/fixtures/blueprints.ts
vendored
3
src/test/fixtures/blueprints.ts
vendored
|
|
@ -144,7 +144,6 @@ export const mockBlueprintComposes: GetBlueprintComposesApiResponse = {
|
|||
{
|
||||
architecture: 'x86_64',
|
||||
image_type: 'aws',
|
||||
snapshot_date: '',
|
||||
upload_request: {
|
||||
type: 'aws',
|
||||
options: {
|
||||
|
|
@ -166,7 +165,6 @@ export const mockBlueprintComposes: GetBlueprintComposesApiResponse = {
|
|||
{
|
||||
architecture: 'x86_64',
|
||||
image_type: 'aws',
|
||||
snapshot_date: '',
|
||||
upload_request: {
|
||||
type: 'aws',
|
||||
options: {
|
||||
|
|
@ -188,7 +186,6 @@ export const mockBlueprintComposes: GetBlueprintComposesApiResponse = {
|
|||
{
|
||||
architecture: 'x86_64',
|
||||
image_type: 'gcp',
|
||||
snapshot_date: '',
|
||||
upload_request: {
|
||||
type: 'gcp',
|
||||
options: {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue