Merge ~otubo/cloud-init:covscan-issues into cloud-init:master

Proposed by Eduardo Otubo
Status: Work in progress
Proposed branch: ~otubo/cloud-init:covscan-issues
Merge into: cloud-init:master
Diff against target: 55 lines (+4/-8)
3 files modified
cloudinit/config/cc_lxd.py (+2/-4)
tools/uncloud-init (+0/-2)
tools/write-ssh-key-fingerprints (+2/-2)
Reviewer Review Type Date Requested Status
Server Team CI bot continuous-integration Needs Fixing
Scott Moser Needs Information
Ryan Harper Pending
Review via email: mp+356275@code.launchpad.net

Commit message

These are small changes caught by covscan that should be fixed with low priority.

To post a comment you must log in.
Revision history for this message
Scott Moser (smoser) wrote :

thoughts?

I do appreciate the static code analysis, but I do not think its correct in any of these cases.

review: Needs Information
Revision history for this message
Server Team CI bot (server-team-bot) wrote :

FAILED: Continuous integration, rev:82284e2e93c8f0967860453377824f898621ff2f
https://jenkins.ubuntu.com/server/job/cloud-init-ci/519/
Executed test runs:
    SUCCESS: Checkout
    FAILED: Unit & Style Tests

Click here to trigger a rebuild:
https://jenkins.ubuntu.com/server/job/cloud-init-ci/519/rebuild

review: Needs Fixing (continuous-integration)

Unmerged commits

82284e2... by Eduardo Otubo

Fixing static code issues found by covscan

A covscan run on cloud-init found these issues that could be quickly
fixed:

1) unecessary join function used:

  cloudinit/config/cc_lxd.py:
  - log.debug("Creating lxd bridge: %s" %
  - " ".join(cmd_create))
  + log.debug("Creating lxd bridge: %s " %
  + cmd_create)

2) Unused variables:

  tools/uncloud-init:
  - helpmount) helpmount=1;;
  - root=*) rootspec=${x#root=};;

  tools/write-ssh-key-fingerprints:
  - read ktype line < "$f"
  + read ktype < "$f"

Signed-off-by: Eduardo Otubo <email address hidden>

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1diff --git a/cloudinit/config/cc_lxd.py b/cloudinit/config/cc_lxd.py
2index 24a8ebe..90c1f12 100644
3--- a/cloudinit/config/cc_lxd.py
4+++ b/cloudinit/config/cc_lxd.py
5@@ -146,13 +146,11 @@ def handle(name, cfg, cloud, log, args):
6 net_name=net_name, did_init=bool(init_cfg),
7 create=bool(cmd_create), attach=bool(cmd_attach))
8 if cmd_create:
9- log.debug("Creating lxd bridge: %s" %
10- " ".join(cmd_create))
11+ log.debug("Creating lxd bridge: %s " % cmd_create)
12 _lxc(cmd_create)
13
14 if cmd_attach:
15- log.debug("Setting up default lxd bridge: %s" %
16- " ".join(cmd_create))
17+ log.debug("Setting up default lxd bridge: %s" % cmd_create)
18 _lxc(cmd_attach)
19
20 elif bridge_cfg:
21diff --git a/tools/uncloud-init b/tools/uncloud-init
22index 217371c..d565845 100755
23--- a/tools/uncloud-init
24+++ b/tools/uncloud-init
25@@ -97,8 +97,6 @@ for x in ${cmdline}; do
26 log "end update ${dev},${fmt}"
27 ;;
28 ubuntu-pass=*|ubuntu_pass=*) ubuntu_pass=${x#*=};;
29- helpmount) helpmount=1;;
30- root=*) rootspec=${x#root=};;
31 esac
32 done
33
34diff --git a/tools/write-ssh-key-fingerprints b/tools/write-ssh-key-fingerprints
35index 2a3dca7..f748259 100755
36--- a/tools/write-ssh-key-fingerprints
37+++ b/tools/write-ssh-key-fingerprints
38@@ -18,7 +18,7 @@ echo "#############################################################"
39 echo "-----BEGIN SSH HOST KEY FINGERPRINTS-----"
40 for f in /etc/ssh/ssh_host_*key.pub; do
41 [ -f "$f" ] || continue
42- read ktype line < "$f"
43+ read ktype < "$f"
44 # skip the key if its type is in the blacklist
45 [ "${fp_blist#*,$ktype,}" = "${fp_blist}" ] || continue
46 ssh-keygen -l -f "$f"
47@@ -31,7 +31,7 @@ echo "#############################################################"
48 echo "-----BEGIN SSH HOST KEY KEYS-----"
49 for f in /etc/ssh/ssh_host_*key.pub; do
50 [ -f "$f" ] || continue
51- read ktype line < "$f"
52+ read ktype < "$f"
53 # skip the key if its type is in the blacklist
54 [ "${key_blist#*,$ktype,}" = "${key_blist}" ] || continue
55 cat $f

Subscribers

People subscribed via source and target branches