Skip to content

Commit c97d43e

Browse files
committed
Fix CI formatting check
Signed-off-by: Gaurav Aggarwal <[email protected]>
1 parent 16a2370 commit c97d43e

File tree

9 files changed

+85
-83
lines changed

9 files changed

+85
-83
lines changed

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -503,13 +503,13 @@ The following creates a job that specifies a Linux Kernel link for downloading.
503503
--document '{"url":"https://cdn.kernel.org/pub/linux/kernel/v5.x/linux-5.8.5.tar.xz"}'
504504
```
505505
3. Run the demo using this command:
506-
```
506+
```
507507
./build/bin/jobs_demo_mosquitto \
508508
-n <thing-name> \
509509
-h <aws-iot endpoint> \
510510
--certfile <device certificate of the thing> \
511511
--keyfile <private key of the thing>
512-
```
512+
```
513513
Note: Replace the placeholders in angle brackets with your specific information.
514514

515515

@@ -670,7 +670,7 @@ First, install Tunnelmole. On Linux, Mac and Windows Subsystem for Linux, use
670670
```sh
671671
curl -O https://tunnelmole.com/sh/install.sh && sudo bash install.sh
672672
```
673-
The above may not function correctly on ARM machines like mac. As an alternative, you can clone the repository and build the application from its source code.
673+
The above may not function correctly on ARM machines like mac. As an alternative, you can clone the repository and build the application from its source code.
674674
For Windows without WSL, [download tmole.exe](https://tunnelmole.com/downloads/tmole.exe) and add it to your [PATH](https://www.wikihow.com/Change-the-PATH-Environment-Variable-on-Windows).
675675

676676
Then run `tmole 80`

demos/fleet_provisioning/fleet_provisioning_keys_cert/fleet_provisioning_keys_cert_demo.c

Lines changed: 30 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -772,57 +772,57 @@ int main( int argc,
772772
LogInfo( ( "Demo completed successfully." ) );
773773

774774
#if defined( DOWNLOADED_CERT_WRITE_PATH )
775+
{
776+
int fd = open( DOWNLOADED_CERT_WRITE_PATH, O_CREAT | O_WRONLY | O_TRUNC, S_IRUSR | S_IWUSR );
777+
778+
if( -1 != fd )
775779
{
776-
int fd = open( DOWNLOADED_CERT_WRITE_PATH, O_CREAT | O_WRONLY | O_TRUNC, S_IRUSR | S_IWUSR );
780+
const ssize_t writtenBytes = write( fd, certificate, certificateLength );
777781

778-
if( -1 != fd )
782+
if( writtenBytes == certificateLength )
779783
{
780-
const ssize_t writtenBytes = write( fd, certificate, certificateLength );
781-
782-
if( writtenBytes == certificateLength )
783-
{
784-
LogInfo( ( "Written %s successfully.", DOWNLOADED_CERT_WRITE_PATH ) );
785-
}
786-
else
787-
{
788-
LogError( ( "Could not write to %s. Error: %s.", DOWNLOADED_CERT_WRITE_PATH, strerror( errno ) ) );
789-
}
790-
791-
close( fd );
784+
LogInfo( ( "Written %s successfully.", DOWNLOADED_CERT_WRITE_PATH ) );
792785
}
793786
else
794787
{
795-
LogError( ( "Could not open %s. Error: %s.", DOWNLOADED_CERT_WRITE_PATH, strerror( errno ) ) );
788+
LogError( ( "Could not write to %s. Error: %s.", DOWNLOADED_CERT_WRITE_PATH, strerror( errno ) ) );
796789
}
790+
791+
close( fd );
797792
}
793+
else
794+
{
795+
LogError( ( "Could not open %s. Error: %s.", DOWNLOADED_CERT_WRITE_PATH, strerror( errno ) ) );
796+
}
797+
}
798798
#else /* if defined( DOWNLOADED_CERT_WRITE_PATH ) */
799799
LogInfo( ( "NOTE: define DOWNLOADED_CERT_WRITE_PATH in order to have the certificate written to disk." ) );
800800
#endif // DOWNLOADED_CERT_WRITE_PATH
801801

802802
#if defined( DOWNLOADED_PRIVATE_KEY_WRITE_PATH )
803+
{
804+
int fd = open( DOWNLOADED_PRIVATE_KEY_WRITE_PATH, O_CREAT | O_WRONLY | O_TRUNC, S_IRUSR | S_IWUSR );
805+
806+
if( -1 != fd )
803807
{
804-
int fd = open( DOWNLOADED_PRIVATE_KEY_WRITE_PATH, O_CREAT | O_WRONLY | O_TRUNC, S_IRUSR | S_IWUSR );
808+
const ssize_t writtenBytes = write( fd, privatekey, privatekeyLength );
805809

806-
if( -1 != fd )
810+
if( writtenBytes == privatekeyLength )
807811
{
808-
const ssize_t writtenBytes = write( fd, privatekey, privatekeyLength );
809-
810-
if( writtenBytes == privatekeyLength )
811-
{
812-
LogInfo( ( "Written %s successfully.", DOWNLOADED_PRIVATE_KEY_WRITE_PATH ) );
813-
}
814-
else
815-
{
816-
LogError( ( "Could not write to %s. Error: %s.", DOWNLOADED_PRIVATE_KEY_WRITE_PATH, strerror( errno ) ) );
817-
}
818-
819-
close( fd );
812+
LogInfo( ( "Written %s successfully.", DOWNLOADED_PRIVATE_KEY_WRITE_PATH ) );
820813
}
821814
else
822815
{
823-
LogError( ( "Could not open %s. Error: %s.", DOWNLOADED_PRIVATE_KEY_WRITE_PATH, strerror( errno ) ) );
816+
LogError( ( "Could not write to %s. Error: %s.", DOWNLOADED_PRIVATE_KEY_WRITE_PATH, strerror( errno ) ) );
824817
}
818+
819+
close( fd );
825820
}
821+
else
822+
{
823+
LogError( ( "Could not open %s. Error: %s.", DOWNLOADED_PRIVATE_KEY_WRITE_PATH, strerror( errno ) ) );
824+
}
825+
}
826826
#else /* if defined( DOWNLOADED_PRIVATE_KEY_WRITE_PATH ) */
827827
LogInfo( ( "NOTE: define DOWNLOADED_PRIVATE_KEY_WRITE_PATH in order to have the private key written to disk." ) );
828828
#endif // DOWNLOADED_PRIVATE_KEY_WRITE_PATH

demos/fleet_provisioning/fleet_provisioning_with_csr/fleet_provisioning_with_csr_demo.c

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -783,29 +783,29 @@ int main( int argc,
783783
LogInfo( ( "Demo completed successfully." ) );
784784

785785
#if defined( DOWNLOADED_CERT_WRITE_PATH )
786+
{
787+
int fd = open( DOWNLOADED_CERT_WRITE_PATH, O_CREAT | O_WRONLY | O_TRUNC, S_IRUSR | S_IWUSR );
788+
789+
if( -1 != fd )
786790
{
787-
int fd = open( DOWNLOADED_CERT_WRITE_PATH, O_CREAT | O_WRONLY | O_TRUNC, S_IRUSR | S_IWUSR );
791+
const ssize_t writtenBytes = write( fd, certificate, certificateLength );
788792

789-
if( -1 != fd )
793+
if( writtenBytes == certificateLength )
790794
{
791-
const ssize_t writtenBytes = write( fd, certificate, certificateLength );
792-
793-
if( writtenBytes == certificateLength )
794-
{
795-
LogInfo( ( "Written %s successfully.", DOWNLOADED_CERT_WRITE_PATH ) );
796-
}
797-
else
798-
{
799-
LogError( ( "Could not write to %s. Error: %s.", DOWNLOADED_CERT_WRITE_PATH, strerror( errno ) ) );
800-
}
801-
802-
close( fd );
795+
LogInfo( ( "Written %s successfully.", DOWNLOADED_CERT_WRITE_PATH ) );
803796
}
804797
else
805798
{
806-
LogError( ( "Could not open %s. Error: %s.", DOWNLOADED_CERT_WRITE_PATH, strerror( errno ) ) );
799+
LogError( ( "Could not write to %s. Error: %s.", DOWNLOADED_CERT_WRITE_PATH, strerror( errno ) ) );
807800
}
801+
802+
close( fd );
808803
}
804+
else
805+
{
806+
LogError( ( "Could not open %s. Error: %s.", DOWNLOADED_CERT_WRITE_PATH, strerror( errno ) ) );
807+
}
808+
}
809809
#else /* if defined( DOWNLOADED_CERT_WRITE_PATH ) */
810810
LogInfo( ( "NOTE: define DOWNLOADED_CERT_WRITE_PATH in order to have the certificate written to disk." ) );
811811
#endif // DOWNLOADED_CERT_WRITE_PATH

demos/greengrass/greengrass_demo_local_auth/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ Next you will need to set up a Root CA for your Greengrass device.
5252

5353
On the Greengrass core, run the following:
5454

55-
1. Create private key for the CA certificate
55+
1. Create private key for the CA certificate
5656
```sh
5757
openssl genrsa -out ca.key 2048
5858
```

demos/http/common/src/README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,9 @@
1616
```
1717

1818
1. You will need an AWS Account with S3 access before beginning. You must install and configure the AWS CLI in order to
19-
use this script.
20-
For information on AWS S3 please see: https://docs.aws.amazon.com/AmazonS3/latest/dev/Welcome.html
21-
For AWS CLI installation information please see: https://docs.aws.amazon.com/cli/latest/userguide/cli-chap-install.html
19+
use this script.
20+
For information on AWS S3 please see: https://docs.aws.amazon.com/AmazonS3/latest/dev/Welcome.html
21+
For AWS CLI installation information please see: https://docs.aws.amazon.com/cli/latest/userguide/cli-chap-install.html
2222
For AWS CLI configuration information please see: https://docs.aws.amazon.com/cli/latest/userguide/cli-chap-configure.html
2323

2424
```sh

demos/http/http_demo_s3_download/README.md

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@ Following steps needs to be followed to configure HTTP S3 Download Demo to use S
44

55
### Prerequisites
66

7-
1. You will need an AWS Account with S3 access before beginning. You must be familiar with AWS IoT and IAM to perform steps using the AWS CLI. You must install and configure the AWS CLI in order to follow the steps.
8-
For information on AWS S3 please see: https://docs.aws.amazon.com/AmazonS3/latest/dev/Welcome.html
9-
For AWS CLI installation information please see: https://docs.aws.amazon.com/cli/latest/userguide/cli-chap-install.html
7+
1. You will need an AWS Account with S3 access before beginning. You must be familiar with AWS IoT and IAM to perform steps using the AWS CLI. You must install and configure the AWS CLI in order to follow the steps.
8+
For information on AWS S3 please see: https://docs.aws.amazon.com/AmazonS3/latest/dev/Welcome.html
9+
For AWS CLI installation information please see: https://docs.aws.amazon.com/cli/latest/userguide/cli-chap-install.html
1010
For AWS CLI configuration information please see: https://docs.aws.amazon.com/cli/latest/userguide/cli-chap-configure.html
1111

1212
```sh
@@ -15,7 +15,7 @@ Following steps needs to be followed to configure HTTP S3 Download Demo to use S
1515

1616
### Detailed Steps
1717

18-
#### 1. Create an AWS IoT thing:
18+
#### 1. Create an AWS IoT thing:
1919

2020
You may utilize an already existing AWS IoT Thing or create a new one in the IoT Core section of the AWS Management Console UI.
2121

@@ -37,8 +37,8 @@ Run the following command in the AWS CLI to attach the device certificate to you
3737
```sh
3838
aws iot attach-thing-principal --thing-name device_thing_name --principal <certificate-arn>
3939
```
40-
41-
#### 3. Configure an IAM role:
40+
41+
#### 3. Configure an IAM role:
4242

4343
Next, configure an IAM role in your AWS account that will be assumed by the credentials provider on behalf of your device. You are required to associate two policies with the role: a trust policy that controls who can assume the role, and an access policy that controls which actions can be performed on which resources by assuming the role.
4444

@@ -108,8 +108,8 @@ Now, run the following command to attach the policy to the IAM user.
108108
aws iam attach-user-policy --policy-arn arn:aws:iam::<your_aws_account_id>:policy/passrolepermission --user-name <user_name>
109109
```
110110

111-
#### 4. Create a role alias:
112-
111+
#### 4. Create a role alias:
112+
113113
Now that you have configured the IAM role, you will create a role alias with AWS IoT. You must provide the following pieces of information when creating a role alias:
114114

115115
RoleAlias: This is the primary key of the role alias data model and hence a mandatory attribute. It is a string; the minimum length is 1 character, and the maximum length is 128 characters.
@@ -120,7 +120,7 @@ Run the following command in the AWS CLI to create a role alias. Use the credent
120120
aws iot create-role-alias --role-alias name-s3-access-role-alias --role-arn arn:aws:iam::<your_aws_account_id>:role/s3-access-role --credential-duration-seconds 3600
121121
```
122122

123-
#### 5. Attach a policy:
123+
#### 5. Attach a policy:
124124
You created and registered a certificate with AWS IoT earlier for successful authentication of your device. Now, you need to create and attach a policy to the certificate to authorize the request for the security token.
125125
```
126126
{
@@ -143,8 +143,8 @@ Use the following command to attach the policy with the certificate you register
143143
aws iot attach-policy --policy-name Thing_Policy_Name --target <certificate-arn>
144144
```
145145

146-
#### 6. Request a security token:
147-
146+
#### 6. Request a security token:
147+
148148
Make an HTTPS request to the credentials provider to fetch a security token. You have to supply the following information:
149149

150150
Certificate and key pair: Because this is an HTTP request over TLS mutual authentication, you have to provide the certificate and the corresponding key pair to your client while making the request. Use the same certificate and key pair that you used during certificate registration with AWS IoT.
@@ -174,13 +174,13 @@ The following is sample output of the describe-endpoint command. It contains the
174174
175175
#### 8. After the following the above steps, configure the below macros in `demo_config.h`.
176176
```c
177-
#define AWS_IOT_THING_NAME "Name of IOT Thing that you provided in STEP 1"
177+
#define AWS_IOT_THING_NAME "Name of IOT Thing that you provided in STEP 1"
178178
#define AWS_IOT_CREDENTIAL_PROVIDER_ROLE "Name of ROLE ALIAS that you provided in STEP 4"
179179
#define AWS_S3_BUCKET_NAME "Name of Bucket that contains the object that needs to be downloaded"
180180
#define AWS_S3_BUCKET_REGION "Region where Bucket is located"
181181
#define AWS_S3_OBJECT_NAME "Name of object that needs to be downloaded from AWS S3"
182182
```
183-
183+
184184
### Parameters
185185

186186
#### device_thing_name

demos/http/http_demo_s3_generate_presigned_url/README.md

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@ Following steps needs to be followed to configure HTTP Generate Pre-signed URL D
44

55
### Prerequisites
66

7-
1. You will need an AWS Account with S3 access before beginning. You must be familiar with AWS IoT and IAM to perform steps using the AWS CLI. You must install and configure the AWS CLI in order to follow the steps.
8-
For information on AWS S3 please see: https://docs.aws.amazon.com/AmazonS3/latest/dev/Welcome.html
9-
For AWS CLI installation information please see: https://docs.aws.amazon.com/cli/latest/userguide/cli-chap-install.html
7+
1. You will need an AWS Account with S3 access before beginning. You must be familiar with AWS IoT and IAM to perform steps using the AWS CLI. You must install and configure the AWS CLI in order to follow the steps.
8+
For information on AWS S3 please see: https://docs.aws.amazon.com/AmazonS3/latest/dev/Welcome.html
9+
For AWS CLI installation information please see: https://docs.aws.amazon.com/cli/latest/userguide/cli-chap-install.html
1010
For AWS CLI configuration information please see: https://docs.aws.amazon.com/cli/latest/userguide/cli-chap-configure.html
1111

1212
```sh
@@ -15,7 +15,7 @@ Following steps needs to be followed to configure HTTP Generate Pre-signed URL D
1515

1616
### Detailed Steps
1717

18-
#### 1. Create an AWS IoT thing:
18+
#### 1. Create an AWS IoT thing:
1919

2020
You may utilize an already existing AWS IoT Thing or create a new one in the IoT Core section of the AWS Management Console UI.
2121

@@ -37,8 +37,8 @@ Run the following command in the AWS CLI to attach the device certificate to you
3737
```sh
3838
aws iot attach-thing-principal --thing-name device_thing_name --principal <certificate-arn>
3939
```
40-
41-
#### 3. Configure an IAM role:
40+
41+
#### 3. Configure an IAM role:
4242

4343
Next, configure an IAM role in your AWS account that will be assumed by the credentials provider on behalf of your device. You are required to associate two policies with the role: a trust policy that controls who can assume the role, and an access policy that controls which actions can be performed on which resources by assuming the role.
4444

@@ -109,8 +109,8 @@ Now, run the following command to attach the policy to the IAM user.
109109
aws iam attach-user-policy --policy-arn arn:aws:iam::<your_aws_account_id>:policy/passrolepermission --user-name <user_name>
110110
```
111111

112-
#### 4. Create a role alias:
113-
112+
#### 4. Create a role alias:
113+
114114
Now that you have configured the IAM role, you will create a role alias with AWS IoT. You must provide the following pieces of information when creating a role alias:
115115

116116
RoleAlias: This is the primary key of the role alias data model and hence a mandatory attribute. It is a string; the minimum length is 1 character, and the maximum length is 128 characters.
@@ -121,7 +121,7 @@ Run the following command in the AWS CLI to create a role alias. Use the credent
121121
aws iot create-role-alias --role-alias name-s3-access-role-alias --role-arn arn:aws:iam::<your_aws_account_id>:role/s3-access-role --credential-duration-seconds 3600
122122
```
123123

124-
#### 5. Attach a policy:
124+
#### 5. Attach a policy:
125125
You created and registered a certificate with AWS IoT earlier for successful authentication of your device. Now, you need to create and attach a policy to the certificate to authorize the request for the security token.
126126
```
127127
{
@@ -144,7 +144,7 @@ Use the following command to attach the policy with the certificate you register
144144
aws iot attach-policy --policy-name Thing_Policy_Name --target <certificate-arn>
145145
```
146146

147-
#### 6. Request a security token:
147+
#### 6. Request a security token:
148148

149149
Run the following command in the AWS CLI to obtain your AWS account-specific endpoint for the credentials provider. See the [DescribeEndpoint API documentation](https://docs.aws.amazon.com/iot/latest/apireference/API_DescribeEndpoint.html) for further details.
150150

@@ -169,13 +169,13 @@ The following is sample output of the describe-endpoint command. It contains the
169169
170170
#### 8. After the following the above steps, configure the below macros in `demo_config.h`.
171171
```c
172-
#define AWS_IOT_THING_NAME "Name of IOT Thing that you provided in STEP 1"
172+
#define AWS_IOT_THING_NAME "Name of IOT Thing that you provided in STEP 1"
173173
#define AWS_IOT_CREDENTIAL_PROVIDER_ROLE "Name of ROLE ALIAS that you provided in STEP 4"
174174
#define AWS_S3_BUCKET_NAME "Name of Bucket that contains the object whose pre-signed URL needs to be generated"
175175
#define AWS_S3_BUCKET_REGION "Region where Bucket is located"
176176
#define AWS_S3_OBJECT_NAME "Name of object hose pre-signed URL needs to be generated"
177177
```
178-
178+
179179
### Parameters
180180

181181
#### device_thing_name

demos/http/http_demo_s3_generate_presigned_url/http_demo_s3_generate_presigned_url.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -293,6 +293,7 @@ static bool printS3ObjectFilePresignedURL( const char * pHost,
293293
/* Initialize the request object. */
294294
requestInfo.pHost = pHost;
295295
requestInfo.hostLen = hostLen;
296+
296297
if( isGet )
297298
{
298299
requestInfo.pMethod = HTTP_METHOD_GET;
@@ -303,6 +304,7 @@ static bool printS3ObjectFilePresignedURL( const char * pHost,
303304
requestInfo.pMethod = HTTP_METHOD_PUT;
304305
requestInfo.methodLen = sizeof( HTTP_METHOD_PUT ) - 1;
305306
}
307+
306308
requestInfo.pPath = pPath;
307309
requestInfo.pathLen = strlen( pPath );
308310

integration-test/mqtt/mqtt_system_test.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1981,13 +1981,13 @@ int main()
19811981
UnityBegin( __FILE__ );
19821982

19831983
#if ( TEST_AGAINST_IOT_CORE )
1984-
{
1985-
RUN_TEST_GROUP( coreMQTT_Integration_AWS_IoT_Compatible );
1986-
}
1984+
{
1985+
RUN_TEST_GROUP( coreMQTT_Integration_AWS_IoT_Compatible );
1986+
}
19871987
#else
1988-
{
1989-
RUN_TEST_GROUP( coreMQTT_Integration );
1990-
}
1988+
{
1989+
RUN_TEST_GROUP( coreMQTT_Integration );
1990+
}
19911991
#endif
19921992

19931993
return UnityEnd();

0 commit comments

Comments
 (0)