Skip to content
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 additional pubber opts #338

Merged
merged 5 commits into from
May 25, 2022
Merged

Conversation

noursaidi
Copy link
Collaborator

  • Adds option for an extra point
  • Adds ability to run additional opts in pubber cli - extra_field and extra_point, e.g.
    bin/pubber sites/udmi_site_model project_id AHU-1 123 extra_point=blahblah
    bin/pubber sites/udmi_site_model project_id AHU-1 123 extra_point extra_field

@noursaidi noursaidi requested a review from grafnu May 24, 2022 14:52
bin/pubber Outdated
@@ -2,8 +2,8 @@

ROOT_DIR=$(realpath $(dirname $0)/..)

if [ $# != 4 ]; then
echo $0 SITE_PATH PROJECT_ID DEVICE_ID SERIAL_NO
if [[ "${#}" -lt "4" ]]; then
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why this? $# is a lot easier to read! (Also, quotes are unnecessary with [[, since it's an explicit different parser to avoid the extra clutter!)

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changed to use (( instead as per style guide

bin/pubber Outdated
@@ -23,4 +23,35 @@ $ROOT_DIR/pubber/bin/build > /dev/null

echo Running tools version `(cd $ROOT_DIR; git describe)`

$ROOT_DIR/pubber/bin/run $project_id $site_path $device_id $serial_no
if [[ "${#}" -gt "0" ]]; then
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would flip the if condition so the short branch is first, rather than after the else (just makes it easier to read)

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

condition flipped

bin/pubber Outdated
fi
done

extra_field="${options[extra_field]}"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

where is this used? I would expect somewhere in this PR to see how the added functionality is used...

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

extraField is an existing pubber config, extra_field provides access to it. I'll update the documentation to describe the additional functionality

@noursaidi noursaidi requested a review from grafnu May 24, 2022 15:45
bin/pubber Outdated

cloud_region=`jq -r .cloud_region $site_path/cloud_iot_config.json`

cat <<EOF > /tmp/pubber_config.json
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

indent seems too much?

@noursaidi
Copy link
Collaborator Author

@grafnu I had to make a change because if extraField is in the pubber config then it's included by pubber, so I made a change to only include extraField if it's set.

@noursaidi noursaidi merged commit 5dd1e33 into faucetsdn:master May 25, 2022
@noursaidi noursaidi deleted the pubberopts branch September 20, 2022 13:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants