-
Notifications
You must be signed in to change notification settings - Fork 45
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add new zss /jes end point for submitting jcl to jes #402
base: v2.x/staging
Are you sure you want to change the base?
Conversation
Signed-off-by: joepun76 <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please have a look at my comments. FYI, I'm still reviewing jesService.c
and jesrequestjson.c
.
c/dsutils.c
Outdated
@@ -0,0 +1,417 @@ | |||
#ifdef METTLE | |||
/* HAS NOT BEEN COMPILED WITH METTLE BEFORE */ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we need this comment? Perhaps #error Metal C is not supported
or something similar would be better?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Replaced comment with #error Metal C is not supported
#ifdef METTLE | ||
/* HAS NOT BEEN COMPILED WITH METTLE BEFORE */ | ||
#else | ||
#include <stdbool.h> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we need all these includes? For example, stdarg.h
and bpxnet.h
aren't needed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removed unnecessary includes
@@ -0,0 +1,417 @@ | |||
#ifdef METTLE |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The file needs the copyright at the top and at the bottom (and any others without one).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Included copyright at the top and at the bottom
h/dsutils.h
Outdated
int getMaxRecordLength(char *dscb); | ||
|
||
int obtainDSCB1(const char *dsname, unsigned int dsnameLength, | ||
const char *volser, unsigned int volserLength, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Bad formatting.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Corrected formatting
#define INDEXED_DSCB 96 | ||
|
||
static char defaultDatasetTypesAllowed[3] = {'A','D','X'}; | ||
static char *defaultCSIFields[] ={ "NAME ", "TYPE ", "VOLSER "}; | ||
static int defaultCSIFieldCount = 3; | ||
|
||
const int DSCB_TRACE = FALSE; | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These are only used in datasetjson.c
, why do we need to expose them in a header?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
They are used in dsutils.c as well
typedef struct Volser_tag { | ||
char value[6]; /* space-padded */ | ||
} Volser; | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you provide doc for these new public functions? See examples in zowe-common-c/h/resmgr.h
or other similar files.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Included comments similar to zowe-common-c/h/resmgr.h
h/dsutils.h
Outdated
char value[6]; /* space-padded */ | ||
} Volser; | ||
|
||
int getVolserForDataset(const DatasetName *dataset, Volser *volser); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Now that these are public, should we use a prefix for function names?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Used prefix "dsutils"
h/dsutils.h
Outdated
} Volser; | ||
|
||
int getVolserForDataset(const DatasetName *dataset, Volser *volser); | ||
char getRecordLengthType(char *dscb); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's a good practise to use const
for arguments you're not mutating, the definitions will need those too.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Used const
c/dsutils.c
Outdated
/* | ||
Dataset only, no wildcards or pds members accepted - beware that this should be wrapped with authentication | ||
*/ | ||
int getVolserForDataset(const DatasetName *dataset, Volser *volser) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is the content of this file the same as the one you removed from datasetjson.c
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, it's the same except that I removed the 'static' in front of the functions.
h/jesrequestsjson.h
Outdated
#define __JESREQUESTSJSON__ 1 | ||
|
||
|
||
#include "stcbase.h" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why do you need all these headers here? Also, you can always use forward declaration for things like HttpResponse
and void including unnecessary headers.
For example,
void respondWithSubmitDataset(struct HttpResponse_tag* response,
const char* absolutePath,
int jsonMode);
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removed this .h file and merged the changes to jesService.h. Only needed declarations were included to get .c file clean compiled
c/jesrequestsjson.c
Outdated
|
||
|
||
void responseWithJobDetails(HttpResponse* response, char* jobID, int jsonMode) { | ||
#ifdef __ZOWE_OS_ZOS |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can this be done once in the beginning of this source other than in every function?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removed this .c file and merged the changes to jesService.c. Updated the code based on this review point
c/jesrequestsjson.c
Outdated
#define NATIVE_CODEPAGE CCSID_EBCDIC_1047 | ||
#endif | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is the reason of having a separate source for this functionality as opposed to putting it into jesService.c
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
All changes that are in jesrequestsjson.c were merged into jesService.c. Please check jesService.c for succeeding review points on jesrequestsjson.c
c/jesrequestsjson.c
Outdated
|
||
jsonStart(jPrinter); | ||
|
||
jsonAddUnterminatedString(jPrinter, "jobId", jobID, 8); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What if jobID
is smaller than 8 bytes?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated the code to pass what is the exact bytes of the jobID
c/jesrequestsjson.c
Outdated
#else /* not __ZOWE_OS_ZOS */ | ||
|
||
/* Currently nothing else has "datasets" */ | ||
/* TBD: Is it really necessary to provide this empty array? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What array?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Deleted the comment
c/jesrequestsjson.c
Outdated
} | ||
|
||
int bufferSize = recordLength+1; | ||
char buffer[bufferSize]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just use DATA_STREAM_BUFFER_SIZE + 1
, otherwise you may end up with VLAs.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated the code based on the comment
c/jesrequestsjson.c
Outdated
// empty record | ||
/* jsonAddString(jPrinter, NULL, ""); */ | ||
} else if (ferror(in)) { | ||
zowelog(NULL, LOG_COMP_RESTDATASET, ZOWE_LOG_DEBUG, "Error reading DSN=%s, rc=%d\n", filename, bytesRead); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you print the actual error code?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added error number in the log
c/jesrequestsjson.c
Outdated
} | ||
} | ||
else { | ||
zowelog(NULL, LOG_COMP_RESTDATASET, ZOWE_LOG_DEBUG, "UPDATE DATASET: body was not JSON!\n"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why do we use this component if it's not related to data sets?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated the correct component
c/jesrequestsjson.c
Outdated
|
||
char *outACB = NULL; | ||
RPLCommon *rpl = NULL; | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same issues as in responseWithSubmitJCLContents
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Included checking of rc
c/jesService.c
Outdated
setResponseStatus(response, 405, "Method Not Allowed"); | ||
addStringHeader(response, "Server", "jdmfws"); | ||
addStringHeader(response, "Transfer-Encoding", "chunked"); | ||
addStringHeader(response, "Allow", "GET, PUT, DELETE"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we allow GET
and PUT
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Only PUT, updated the code
Signed-off-by: 1000TurquoisePogs <[email protected]>
Signed-off-by: Aditya Ranshinge <[email protected]>
Fix collision with debug ifdef
…intf-with-zowelog configure log component
Signed-off-by: Oscar Jr Celis <[email protected]>
Signed-off-by: ojelis <[email protected]>
h/dsutils.h
Outdated
* @return lrecl return the length of a dataset | ||
* 0 this function encountered error | ||
*/ | ||
int dsutilsGetLreclOrRespondError(HttpResponse *response, const DatasetName *dsn, const char *ddPath); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The "respond" functions and the functions with http related code don't seem to belong here.
The name dsutils
implies some generic data set utils, but the source contains http service speicific code . Did you intend that?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated dsutils and jesService.
h/dsutils.h
Outdated
* @return lrecl return the length of a dataset | ||
* 0 this function encountered error | ||
*/ | ||
int dsutilsGetLreclOrRespondError(HttpResponse *response, const DatasetName *dsn, const char *ddPath); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The "respond" functions and the functions with http related code don't seem to belong here.
The name dsutils
implies some generic data set utils, but the source contains http service speicific code . Did you intend that?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated dustils and jesService.
Signed-off-by: ojelis <[email protected]>
Signed-off-by: ojelis <[email protected]>
Signed-off-by: ojcelis <[email protected]>
Signed-off-by: ojcelis <[email protected]>
Signed-off-by: ojcelis <[email protected]>
Signed-off-by: joepun76 [email protected]
Proposed changes
This PR addresses Issue: [Link to Github issue within https://github.com/zowe/zlux/issues if any]
This PR depends upon the following PRs:
Type of change
Please delete options that are not relevant.
PR Checklist
Please delete options that are not relevant.
Testing
Further comments
Add new end point /jes to submit jcl to jes (both jes2 and jes3 are support) with JOBID returned.