Merge lp:~cpe-sa/orange-box/staging into lp:orange-box

Proposed by Nicolas Thomas
Status: Needs review
Proposed branch: lp:~cpe-sa/orange-box/staging
Merge into: lp:orange-box
Diff against target: 1907 lines (+176/-779)
21 files modified
debian/changelog (+69/-11)
debian/control (+3/-1)
debian/install (+3/-0)
debian/postinst (+0/-310)
debian/postrm (+0/-23)
debian/preinst (+0/-136)
debian/source/format (+1/-1)
etc/apt/orange-box-mirror.list (+1/-1)
usr/bin/orange-box-add-node (+7/-4)
usr/bin/orange-box-add-physical-nodes (+7/-2)
usr/bin/orange-box-add-virtual-nodes (+0/-93)
usr/bin/orange-box-amt-monitor (+3/-1)
usr/bin/orange-box-apm-power-fix (+0/-38)
usr/bin/orange-box-bootstrap-juju (+0/-31)
usr/bin/orange-box-create-package-mirror (+14/-1)
usr/bin/orange-box-demo-cleanup (+3/-1)
usr/bin/orange-box-hacks (+32/-0)
usr/bin/orange-box-purge-everything (+1/-0)
usr/bin/orange-box-run (+21/-18)
usr/bin/orange-box-setup-nat (+0/-99)
usr/bin/orange-box-status-all-nodes (+11/-8)
To merge this branch: bzr merge lp:~cpe-sa/orange-box/staging
Reviewer Review Type Date Requested Status
Orange Box Pending
Review via email: mp+265504@code.launchpad.net

Description of the change

This is the test by SAs last revision of the OB code.

Wish to make it official

To post a comment you must log in.
Revision history for this message
Zhanglei Mao (zhanglei-mao) wrote :

Nicolas,

How can I do tests use your new merged package. I supposed that I can just follow OrangeBox V2 manual and it will use automatically. Is it right?

I install it step by step as manual before your merge time and stop at:
+ sudo -u maas virsh -c qemu+ssh://ubuntu@172.27.8.1/system list
error: failed to connect to the hypervisor
error: Cannot recv data: Permission denied (publickey).: Connection reset by pee

After I see your merge mail, I purge, reboot and rerun (apt-get install orange-box) again, it shows error as:
+ orange-box-add-virtual-nodes
+ virsh net-info default
error: failed to get network 'default'
error: Network not found: no network with matching name 'default'

I doubt both of them are caused by not using of new scripts. I will try it again from beginning again to verify it.

thanks,
Mao

lp:~cpe-sa/orange-box/staging updated
552. By Brad Erhart <email address hidden>

* debian/control: Added qemu-system. Removed biosdevname
* debian/postinst: Disabled VM creation during install. Added network config for maas-br0
* debian/preinst: Removed biosdevname due to issues

Revision history for this message
Zhanglei Mao (zhanglei-mao) wrote :

hi Brad,

I test it again. It is still stop at the errors as yesterday. I follow the manual, only exception are area use local Hongkong and I use Wifi for internet.

# 172.27.8.1 SSH-2.0-OpenSSH_6.6.1p1 Ubuntu-2ubuntu2
+ sudo -u maas tee -a /var/lib/maas/.ssh/known_hosts
+ sudo -u maas ssh-keyscan 172.27.8.1
# 172.27.8.1 SSH-2.0-OpenSSH_6.6.1p1 Ubuntu-2ubuntu2
# 172.27.8.1 SSH-2.0-OpenSSH_6.6.1p1 Ubuntu-2ubuntu2
+ sudo -u maas virsh -c qemu+ssh://ubuntu@172.27.8.1/system list
error: failed to connect to the hypervisor
error: Cannot recv data: Permission denied (publickey).: Connection reset by peer
+ sed -i '/ maas@/d' /home/ubuntu/.ssh/authorized_keys
sed: can't read /home/ubuntu/.ssh/authorized_keys: No such file or directory
dpkg: error processing package orange-box (--configure):
 subprocess installed post-installation script returned error exit status 2
Setting up libwww-perl (6.05-2) ...
Setting up libxml-parser-perl (2.41-1build3) ...
Setting up libsoap-lite-perl (1.09-1) ...
Setting up libxmlrpc-lite-perl (0.717-1) ...
Processing triggers for libc-bin (2.19-0ubuntu6.6) ...
Processing triggers for initramfs-tools (0.103ubuntu4.2) ...
update-initramfs: Generating /boot/initrd.img-3.16.0-44-generic
Errors were encountered while processing:
 orange-box
E: Sub-process /usr/bin/dpkg returned an error code (1)
ubuntu@OrangeBox8:~$

thanks,
Mao

Revision history for this message
Nicolas Thomas (thomnico) wrote :

Brad this should not append with my last modification merged on the code???

Mao please send orange-box-add-virtual-nodes script ..

On Thu, Jul 23, 2015 at 1:06 PM, Zhanglei Mao
<email address hidden> wrote:
> hi Brad,
>
> I test it again. It is still stop at the errors as yesterday. I follow the manual, only exception are area use local Hongkong and I use Wifi for internet.
>
> # 172.27.8.1 SSH-2.0-OpenSSH_6.6.1p1 Ubuntu-2ubuntu2
> + sudo -u maas tee -a /var/lib/maas/.ssh/known_hosts
> + sudo -u maas ssh-keyscan 172.27.8.1
> # 172.27.8.1 SSH-2.0-OpenSSH_6.6.1p1 Ubuntu-2ubuntu2
> # 172.27.8.1 SSH-2.0-OpenSSH_6.6.1p1 Ubuntu-2ubuntu2
> + sudo -u maas virsh -c qemu+ssh://ubuntu@172.27.8.1/system list
> error: failed to connect to the hypervisor
> error: Cannot recv data: Permission denied (publickey).: Connection reset by peer
> + sed -i '/ maas@/d' /home/ubuntu/.ssh/authorized_keys
> sed: can't read /home/ubuntu/.ssh/authorized_keys: No such file or directory
> dpkg: error processing package orange-box (--configure):
> subprocess installed post-installation script returned error exit status 2
> Setting up libwww-perl (6.05-2) ...
> Setting up libxml-parser-perl (2.41-1build3) ...
> Setting up libsoap-lite-perl (1.09-1) ...
> Setting up libxmlrpc-lite-perl (0.717-1) ...
> Processing triggers for libc-bin (2.19-0ubuntu6.6) ...
> Processing triggers for initramfs-tools (0.103ubuntu4.2) ...
> update-initramfs: Generating /boot/initrd.img-3.16.0-44-generic
> Errors were encountered while processing:
> orange-box
> E: Sub-process /usr/bin/dpkg returned an error code (1)
> ubuntu@OrangeBox8:~$
>
> thanks,
> Mao
> --
> https://code.launchpad.net/~cpe-sa/orange-box/staging/+merge/265504
> You proposed lp:~cpe-sa/orange-box/staging for merging.

--
Best Regards,
       Nicolas Thomas
http://insights.ubuntu.com/?p=889
EMEA Solution Architect Canonical
GPG FPR: D592 4185 F099 9031 6590 6292 492F C740 F03A 7EB9

Revision history for this message
Zhanglei Mao (zhanglei-mao) wrote :

My orange-box-add-virtual-nodes script was enclosed

On Thu, Jul 23, 2015 at 7:21 PM, Nicolas Thomas <
<email address hidden>> wrote:

> Brad this should not append with my last modification merged on the code???
>
> Mao please send orange-box-add-virtual-nodes script ..
>
> On Thu, Jul 23, 2015 at 1:06 PM, Zhanglei Mao
> <email address hidden> wrote:
> > hi Brad,
> >
> > I test it again. It is still stop at the errors as yesterday. I follow
> the manual, only exception are area use local Hongkong and I use Wifi for
> internet.
> >
> > # 172.27.8.1 SSH-2.0-OpenSSH_6.6.1p1 Ubuntu-2ubuntu2
> > + sudo -u maas tee -a /var/lib/maas/.ssh/known_hosts
> > + sudo -u maas ssh-keyscan 172.27.8.1
> > # 172.27.8.1 SSH-2.0-OpenSSH_6.6.1p1 Ubuntu-2ubuntu2
> > # 172.27.8.1 SSH-2.0-OpenSSH_6.6.1p1 Ubuntu-2ubuntu2
> > + sudo -u maas virsh -c qemu+ssh://ubuntu@172.27.8.1/system list
> > error: failed to connect to the hypervisor
> > error: Cannot recv data: Permission denied (publickey).: Connection
> reset by peer
> > + sed -i '/ maas@/d' /home/ubuntu/.ssh/authorized_keys
> > sed: can't read /home/ubuntu/.ssh/authorized_keys: No such file or
> directory
> > dpkg: error processing package orange-box (--configure):
> > subprocess installed post-installation script returned error exit
> status 2
> > Setting up libwww-perl (6.05-2) ...
> > Setting up libxml-parser-perl (2.41-1build3) ...
> > Setting up libsoap-lite-perl (1.09-1) ...
> > Setting up libxmlrpc-lite-perl (0.717-1) ...
> > Processing triggers for libc-bin (2.19-0ubuntu6.6) ...
> > Processing triggers for initramfs-tools (0.103ubuntu4.2) ...
> > update-initramfs: Generating /boot/initrd.img-3.16.0-44-generic
> > Errors were encountered while processing:
> > orange-box
> > E: Sub-process /usr/bin/dpkg returned an error code (1)
> > ubuntu@OrangeBox8:~$
> >
> > thanks,
> > Mao
> > --
> > https://code.launchpad.net/~cpe-sa/orange-box/staging/+merge/265504
> > You proposed lp:~cpe-sa/orange-box/staging for merging.
>
>
>
> --
> Best Regards,
> Nicolas Thomas
> http://insights.ubuntu.com/?p=889
> EMEA Solution Architect Canonical
> GPG FPR: D592 4185 F099 9031 6590 6292 492F C740 F03A 7EB9
>
> https://code.launchpad.net/~cpe-sa/orange-box/staging/+merge/265504
> Your team Orange Box is requested to review the proposed merge of
> lp:~cpe-sa/orange-box/staging into lp:orange-box.
>

--
Zhanglei Mao
Solutions Architect, Sales and Business Development
Canonical Group Ltd.
<email address hidden>
+86-13625010929 (m)
+852-6700 6026 (m)
www.ubuntu.com
www.canonical.com

Revision history for this message
Nicolas Thomas (thomnico) wrote :
Download full text (3.2 KiB)

I see Brad change the all behavior instead of fixing bugs . can't
afford the time to play that game.. refer to Brad fro now on..
Changing behavior /doc and way of operating when seeing a bug is a
receipt for never releasing/delivering ..

On Thu, Jul 23, 2015 at 1:30 PM, Zhanglei Mao
<email address hidden> wrote:
> My orange-box-add-virtual-nodes script was enclosed
>
> On Thu, Jul 23, 2015 at 7:21 PM, Nicolas Thomas <
> <email address hidden>> wrote:
>
>> Brad this should not append with my last modification merged on the code???
>>
>> Mao please send orange-box-add-virtual-nodes script ..
>>
>> On Thu, Jul 23, 2015 at 1:06 PM, Zhanglei Mao
>> <email address hidden> wrote:
>> > hi Brad,
>> >
>> > I test it again. It is still stop at the errors as yesterday. I follow
>> the manual, only exception are area use local Hongkong and I use Wifi for
>> internet.
>> >
>> > # 172.27.8.1 SSH-2.0-OpenSSH_6.6.1p1 Ubuntu-2ubuntu2
>> > + sudo -u maas tee -a /var/lib/maas/.ssh/known_hosts
>> > + sudo -u maas ssh-keyscan 172.27.8.1
>> > # 172.27.8.1 SSH-2.0-OpenSSH_6.6.1p1 Ubuntu-2ubuntu2
>> > # 172.27.8.1 SSH-2.0-OpenSSH_6.6.1p1 Ubuntu-2ubuntu2
>> > + sudo -u maas virsh -c qemu+ssh://ubuntu@172.27.8.1/system list
>> > error: failed to connect to the hypervisor
>> > error: Cannot recv data: Permission denied (publickey).: Connection
>> reset by peer
>> > + sed -i '/ maas@/d' /home/ubuntu/.ssh/authorized_keys
>> > sed: can't read /home/ubuntu/.ssh/authorized_keys: No such file or
>> directory
>> > dpkg: error processing package orange-box (--configure):
>> > subprocess installed post-installation script returned error exit
>> status 2
>> > Setting up libwww-perl (6.05-2) ...
>> > Setting up libxml-parser-perl (2.41-1build3) ...
>> > Setting up libsoap-lite-perl (1.09-1) ...
>> > Setting up libxmlrpc-lite-perl (0.717-1) ...
>> > Processing triggers for libc-bin (2.19-0ubuntu6.6) ...
>> > Processing triggers for initramfs-tools (0.103ubuntu4.2) ...
>> > update-initramfs: Generating /boot/initrd.img-3.16.0-44-generic
>> > Errors were encountered while processing:
>> > orange-box
>> > E: Sub-process /usr/bin/dpkg returned an error code (1)
>> > ubuntu@OrangeBox8:~$
>> >
>> > thanks,
>> > Mao
>> > --
>> > https://code.launchpad.net/~cpe-sa/orange-box/staging/+merge/265504
>> > You proposed lp:~cpe-sa/orange-box/staging for merging.
>>
>>
>>
>> --
>> Best Regards,
>> Nicolas Thomas
>> http://insights.ubuntu.com/?p=889
>> EMEA Solution Architect Canonical
>> GPG FPR: D592 4185 F099 9031 6590 6292 492F C740 F03A 7EB9
>>
>> https://code.launchpad.net/~cpe-sa/orange-box/staging/+merge/265504
>> Your team Orange Box is requested to review the proposed merge of
>> lp:~cpe-sa/orange-box/staging into lp:orange-box.
>>
>
>
>
> --
> Zhanglei Mao
> Solutions Architect, Sales and Business Development
> Canonical Group Ltd.
> <email address hidden>
> +86-13625010929 (m)
> +852-6700 6026 (m)
> www.ubuntu.com
> www.canonical.com
>
> https://code.launchpad.net/~cpe-sa/orange-box/staging/+merge/265504
> You proposed lp:~cpe-sa/orange-box/staging for merging.

--
Best Regards,
       Nicolas Thomas
http://insights.ubuntu.com/?p=889
E...

Read more...

Revision history for this message
vio0au0d (chei6ied-deactivatedaccount) wrote :
Download full text (3.8 KiB)

> I see Brad change the all behavior instead of fixing bugs . can't
> afford the time to play that game.. refer to Brad fro now on..
> Changing behavior /doc and way of operating when seeing a bug is a
> receipt for never releasing/delivering ..
I have no clue what that means Nicolas. It does not translate very well. Yes I did have to revert some changes that you made because they were breaking the install. I'd be more than happy to help find solutions, but I don't have time to not have a working package. Please review the revision history and you'll see that they were merely commented out and can be re-added once they've been tested by multiple people.

>
>
>
>
> On Thu, Jul 23, 2015 at 1:30 PM, Zhanglei Mao
> <email address hidden> wrote:
> > My orange-box-add-virtual-nodes script was enclosed
> >
> > On Thu, Jul 23, 2015 at 7:21 PM, Nicolas Thomas <
> > <email address hidden>> wrote:
> >
> >> Brad this should not append with my last modification merged on the code???
> >>
> >> Mao please send orange-box-add-virtual-nodes script ..
> >>
> >> On Thu, Jul 23, 2015 at 1:06 PM, Zhanglei Mao
> >> <email address hidden> wrote:
> >> > hi Brad,
> >> >
> >> > I test it again. It is still stop at the errors as yesterday. I follow
> >> the manual, only exception are area use local Hongkong and I use Wifi for
> >> internet.
> >> >
> >> > # 172.27.8.1 SSH-2.0-OpenSSH_6.6.1p1 Ubuntu-2ubuntu2
> >> > + sudo -u maas tee -a /var/lib/maas/.ssh/known_hosts
> >> > + sudo -u maas ssh-keyscan 172.27.8.1
> >> > # 172.27.8.1 SSH-2.0-OpenSSH_6.6.1p1 Ubuntu-2ubuntu2
> >> > # 172.27.8.1 SSH-2.0-OpenSSH_6.6.1p1 Ubuntu-2ubuntu2
> >> > + sudo -u maas virsh -c qemu+ssh://ubuntu@172.27.8.1/system list
> >> > error: failed to connect to the hypervisor
> >> > error: Cannot recv data: Permission denied (publickey).: Connection
> >> reset by peer
> >> > + sed -i '/ maas@/d' /home/ubuntu/.ssh/authorized_keys
> >> > sed: can't read /home/ubuntu/.ssh/authorized_keys: No such file or
> >> directory
> >> > dpkg: error processing package orange-box (--configure):
> >> > subprocess installed post-installation script returned error exit
> >> status 2
> >> > Setting up libwww-perl (6.05-2) ...
> >> > Setting up libxml-parser-perl (2.41-1build3) ...
> >> > Setting up libsoap-lite-perl (1.09-1) ...
> >> > Setting up libxmlrpc-lite-perl (0.717-1) ...
> >> > Processing triggers for libc-bin (2.19-0ubuntu6.6) ...
> >> > Processing triggers for initramfs-tools (0.103ubuntu4.2) ...
> >> > update-initramfs: Generating /boot/initrd.img-3.16.0-44-generic
> >> > Errors were encountered while processing:
> >> > orange-box
> >> > E: Sub-process /usr/bin/dpkg returned an error code (1)
> >> > ubuntu@OrangeBox8:~$
> >> >
> >> > thanks,
> >> > Mao
> >> > --
> >> > https://code.launchpad.net/~cpe-sa/orange-box/staging/+merge/265504
> >> > You proposed lp:~cpe-sa/orange-box/staging for merging.
> >>
> >>
> >>
> >> --
> >> Best Regards,
> >> Nicolas Thomas
> >> http://insights.ubuntu.com/?p=889
> >> EMEA Solution Architect Canonical
> >> GPG FPR: D592 4185 F099 9031 6590 6292 492F C740 F03A 7EB9
> >>
> >> https://code.launchpad.net/~cpe-sa/orange-box/staging/+m...

Read more...

Revision history for this message
mahmoh (mahmoh) wrote :
Download full text (4.5 KiB)

On 07/23/2015 11:14 AM, Brad wrote:
>> I see Brad change the all behavior instead of fixing bugs . can't
>> afford the time to play that game.. refer to Brad fro now on..
>> Changing behavior /doc and way of operating when seeing a bug is a
>> receipt for never releasing/delivering ..
> I have no clue what that means Nicolas. It does not translate very well. Yes I did have to revert some changes that you made because they were breaking the install. I'd be more than happy to help find solutions, but I don't have time to not have a working package. Please review the revision history and you'll see that they were merely commented out and can be re-added once they've been tested by multiple people.

I think what Nicolas means is, for example, instead of documenting a
"reboot" in the manual to fix a problem in the package/scripts we should
be fixing/adjusting the package/scripts to solve the problem instead and
if possible.

I understand and appreciate your deadline of getting a working package
for tomorrow & next week but I also understand and agree with Nicolas'
frustration that it doesn't excuse us from properly fixing problems.

My suggestion at this point is get a working package for tomorrow's
deadline but schedule a mini-sprint ASAP so we can work this out. We
could use next week's team time to discuss this if anyone's interested?

>
>>
>>
>>
>>
>> On Thu, Jul 23, 2015 at 1:30 PM, Zhanglei Mao
>> <email address hidden> wrote:
>>> My orange-box-add-virtual-nodes script was enclosed
>>>
>>> On Thu, Jul 23, 2015 at 7:21 PM, Nicolas Thomas <
>>> <email address hidden>> wrote:
>>>
>>>> Brad this should not append with my last modification merged on the code???
>>>>
>>>> Mao please send orange-box-add-virtual-nodes script ..
>>>>
>>>> On Thu, Jul 23, 2015 at 1:06 PM, Zhanglei Mao
>>>> <email address hidden> wrote:
>>>>> hi Brad,
>>>>>
>>>>> I test it again. It is still stop at the errors as yesterday. I follow
>>>> the manual, only exception are area use local Hongkong and I use Wifi for
>>>> internet.
>>>>>
>>>>> # 172.27.8.1 SSH-2.0-OpenSSH_6.6.1p1 Ubuntu-2ubuntu2
>>>>> + sudo -u maas tee -a /var/lib/maas/.ssh/known_hosts
>>>>> + sudo -u maas ssh-keyscan 172.27.8.1
>>>>> # 172.27.8.1 SSH-2.0-OpenSSH_6.6.1p1 Ubuntu-2ubuntu2
>>>>> # 172.27.8.1 SSH-2.0-OpenSSH_6.6.1p1 Ubuntu-2ubuntu2
>>>>> + sudo -u maas virsh -c qemu+ssh://ubuntu@172.27.8.1/system list
>>>>> error: failed to connect to the hypervisor
>>>>> error: Cannot recv data: Permission denied (publickey).: Connection
>>>> reset by peer
>>>>> + sed -i '/ maas@/d' /home/ubuntu/.ssh/authorized_keys
>>>>> sed: can't read /home/ubuntu/.ssh/authorized_keys: No such file or
>>>> directory
>>>>> dpkg: error processing package orange-box (--configure):
>>>>> subprocess installed post-installation script returned error exit
>>>> status 2
>>>>> Setting up libwww-perl (6.05-2) ...
>>>>> Setting up libxml-parser-perl (2.41-1build3) ...
>>>>> Setting up libsoap-lite-perl (1.09-1) ...
>>>>> Setting up libxmlrpc-lite-perl (0.717-1) ...
>>>>> Processing triggers for libc-bin (2.19-0ubuntu6.6) ...
>>>>> Processing triggers for initramfs-tools (0.103ubuntu4.2) ...
>>>>> update-initramfs: ...

Read more...

lp:~cpe-sa/orange-box/staging updated
553. By Brad Erhart <email address hidden>

* usr/bin/orange-box-add-virtual-nodes: Removed as this is now part of orange-box-examples
* usr/bin/orange-box-bootstrap-juju: Removed as this is now part of orange-box-examples
* usr/bin/orange-box-status-all-nodes: Updated per new VM naming schema

Unmerged revisions

553. By Brad Erhart <email address hidden>

* usr/bin/orange-box-add-virtual-nodes: Removed as this is now part of orange-box-examples
* usr/bin/orange-box-bootstrap-juju: Removed as this is now part of orange-box-examples
* usr/bin/orange-box-status-all-nodes: Updated per new VM naming schema

552. By Brad Erhart <email address hidden>

* debian/control: Added qemu-system. Removed biosdevname
* debian/postinst: Disabled VM creation during install. Added network config for maas-br0
* debian/preinst: Removed biosdevname due to issues

551. By Brad Erhart <email address hidden>

More comments

550. By Brad Erhart <email address hidden>

Merged changes from newnet

549. By Brad Erhart <email address hidden>

Added additional comments

modified:
  usr/bin/orange-box-add-virtual-nodes

548. By Brad Erhart <email address hidden>

Cleanup and comments

547. By Nicolas Thomas

fix default to em1 for internal_interface

546. By Nicolas Thomas

Fix zone issue
Fix ssh-keyscan for maas asking user intervention

545. By Nicolas Thomas

updates on ssh maas to ubuntu automation

modified:
  debian/changelog
  usr/bin/orange-box-add-virtual-nodes

544. By Nicolas Thomas

releasing 2.9~ppa2

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'debian/changelog'
2--- debian/changelog 2015-01-21 22:04:42 +0000
3+++ debian/changelog 2015-07-23 19:54:40 +0000
4@@ -1,20 +1,78 @@
5-orange-box (1.90) unreleased; urgency=medium
6-
7- * etc/apt/orange-box-mirror.list, usr/bin/orange-box-create-package-
8- mirror:
9- - we're not currently using postmirror.sh, so set to /bin/true
10-
11- -- Dustin Kirkland <kirkland@ubuntu.com> Fri, 09 Jan 2015 11:13:51 -0600
12-
13-orange-box (1.89-0ubuntu1) vivid; urgency=medium
14-
15+orange-box (2.91~0ubuntu2~trusty) trusty; urgency=medium
16+
17+ * usr/bin/orange-box-add-virtual-nodes: Removed as this is now part of orange-box-examples
18+ * usr/bin/orange-box-bootstrap-juju: Removed as this is now part of orange-box-examples
19+ * usr/bin/orange-box-status-all-nodes: Updated per new VM naming schema
20+
21+ -- Brad Erhart <brad.erhart@canonical.com> Thu, 23 Jul 2015 12:51:28 -0700
22+
23+orange-box (2.91~0ubuntu1~trusty) trusty; urgency=medium
24+
25+ * debian/control: Added qemu-system. Removed biosdevname
26+ * debian/postinst: Disabled VM creation during install. Added network config for maas-br0
27+ * debian/preinst: Removed biosdevname due to issues
28+
29+ -- Brad Erhart <brad.erhart@canonical.com> Wed, 21 Jul 2015 16:25:25 -0700
30+
31+orange-box (2.9~0ubuntu2~trusty) trusty; urgency=medium
32+
33+ [ Brad Erhart ]
34+ * debian/control, debian/links, debian/postinst, debian/preinst,
35+ usr/bin/orange-box-add-virtual-nodes: Cleanup and comments
36+
37+ -- Brad Erhart <brad.erhart@canonical.com> Mon, 20 Jul 2015 16:17:29 -0700
38+
39+orange-box (2.9ubuntu1~trusty) trusty; urgency=medium
40+
41+ * Change source/format for bzr-buildpackage to work
42+ * Fix issue with the ssh checking for power management of VMs
43+
44+ -- Nicolas Thomas <nicolas.thomas@canonical.com> Mon, 15 Jun 2015 13:32:06 +0200
45+
46+orange-box (2.9-0ubuntu1) trusty; urgency=medium
47+
48+ * Add biosdevname cmd in scripts
49+ * Add a check/heal for VMs powermanagement ssh keys
50+
51+ -- Nicolas Thomas <nicolas.thomas@canonical.com> Mon, 15 Jun 2015 10:40:23 +0200
52+
53+orange-box (2.8ubuntu1~trusty-0ubuntu1) trusty; urgency=medium
54+
55+ [ Nicolas Thomas ]
56+ * Remove synccharmstore etc..
57+ * Adapt a number of changes to network setup etc..
58+ * Assume ob number in preinst and check in postinst in case network is not up
59+ * preinst bridgeutils
60+
61+ -- Nicolas Thomas <nicolas.thomas@canonical.com> Thu, 11 Jun 2015 20:59:08 +0200
62+
63+orange-box (2.7) trusty; urgency=medium
64+
65+ [ Takenori Matsumoto ]
66+ * usr/bin/orange-box-setup-nat:
67+ - Fix net.ipv4.conf.all.accept_redirects
68+ * usr/bin/orange-box-add-virtual-node
69+ - Fix Add maas's ssh key into /home/ubuntu/.ssh/authorized_keys so that MAAS can control power via virsh
70+
71+ -- Takenori Matsumoto <takenori.matsumoto@canonical.com> Fri, 02 May 2015 14:13:51 -0600
72+
73+orange-box (2.6) trusty; urgency=medium
74+
75+ [ Takenori Matsumoto ]
76+ * Re-write pachtes based on PPA (orange-box_1.89-0ubuntu1~trusty.debian.tar.xz, orange-box_1.89.orig.tar.gz) rather than trunk codes
77+
78+ -- Takenori Matsumoto <takenori.matsumoto@canonical.com> Fri, 02 May 2015 01:13:51 -0600
79+
80+orange-box (1.89-0ubuntu1~trusty) trusty; urgency=medium
81+
82+ [ Dustin Kirkland ]
83 * usr/bin/orange-box-bootstrap-juju:
84 - go back to --upload-tools, please keep this!
85 * usr/bin/orange-box-add-virtual-nodes:
86 - use ~maas rather than hard coding to /home/maas
87 + note that maas 1.7 has created a home directory in /var/lib/maas
88
89- -- Dustin Kirkland <kirkland@ubuntu.com> Fri, 09 Jan 2015 11:13:49 -0600
90+ -- Dustin Kirkland <kirkland@ubuntu.com> Wed, 29 Oct 2014 09:58:53 -0500
91
92 orange-box (1.88-0ubuntu1) unstable; urgency=medium
93
94
95=== modified file 'debian/control'
96--- debian/control 2014-09-24 12:15:15 +0000
97+++ debian/control 2015-07-23 19:54:40 +0000
98@@ -10,6 +10,8 @@
99 Architecture: all
100 Pre-Depends:
101 run-one,
102+ nmap,
103+ bridge-utils,
104 Depends: ${misc:Depends},
105 amtterm,
106 apache2,
107@@ -30,9 +32,9 @@
108 maas,
109 maas-cluster-controller,
110 network-manager,
111- nmap,
112 pastebinit,
113 qemu-kvm,
114+ qemu-system,
115 remmina,
116 tree,
117 ubuntu-desktop,
118
119=== added file 'debian/install'
120--- debian/install 1970-01-01 00:00:00 +0000
121+++ debian/install 2015-07-23 19:54:40 +0000
122@@ -0,0 +1,3 @@
123+etc/
124+home/
125+usr/
126
127=== added file 'debian/postinst'
128--- debian/postinst 1970-01-01 00:00:00 +0000
129+++ debian/postinst 2015-07-23 19:54:40 +0000
130@@ -0,0 +1,375 @@
131+#!/bin/bash
132+
133+set -e
134+set -x
135+
136+PKG="orange-box"
137+RETRY=120
138+
139+. /usr/lib/orange-box/inc/common
140+. /etc/orange-box.conf
141+
142+check_orangebox_number() {
143+## be sure to wake AMT first give some time and ping again.
144+nmap -p 16992 -oG - 172.27.${orangebox_number}.11-20 > /dev/null
145+sleep 12
146+nmap -p 16992 -oG - 172.27.${orangebox_number}.11-20 > /dev/null
147+NUMAMTS=`nmap -p 16992 -oG - 172.27.${orangebox_number}.11-20 |grep open |wc -l`
148+[[ $NUMAMTS < 3 ]] && (echo "AMT or hostname not set correctly"; rm -f /etc/orange-box.conf;exit 2)
149+true
150+}
151+
152+# Set network variables
153+router_ip=172.27.${orangebox_number}.1
154+static_low=172.27.`expr ${orangebox_number} + 2`.1
155+static_high=172.27.`expr ${orangebox_number} + 2`.254
156+dhcp_low=172.27.`expr ${orangebox_number} + 1`.1
157+dhcp_high=172.27.`expr ${orangebox_number} + 1`.254
158+br0_broadcast=172.27.`expr ${orangebox_number} + 3`.255
159+
160+setup_maas_admin() {
161+ # Configure the MAAS admin user
162+ # Sadly, there's no way to test if the user has been created already,
163+ # so ignore errors for idempotence
164+ maas-region-admin createadmin --username admin --email maas-admin@example.com --password="admin" 2>/dev/null || true
165+ . /etc/maas/maas_cluster.conf
166+ APIKEY=$(maas-region-admin apikey --username admin | tail -n1)
167+ maas login admin $MAAS_URL $APIKEY
168+}
169+
170+setup_maas_networking() {
171+ count=0
172+ while ! maas admin node-group-interfaces list $CLUSTER_UUID >/dev/null 2>&1; do
173+ count=$((count+1))
174+ sleep 1
175+ if [ $count -gt $RETRY ]; then
176+ error "[maas admin node-group-interfaces list] failed [$RETRY] times"
177+ fi
178+ done
179+ internal_interface=$(route -n | grep "^172\.27\.${orangebox_number}\." | sed -e "s/.* //")
180+ # Support MAAS 1.5, and 1.6
181+ maas_ver=$(dpkg -l maas | tail -n1 | awk '{print $3}')
182+ if dpkg --compare-versions $maas_ver lt 1.6; then
183+ maas admin node-group-interface update $CLUSTER_UUID $internal_interface ip_range_low=$static_low ip_range_high=$static_high management=2 broadcast_ip=$br0_broadcast router_ip=$router_ip
184+
185+ else
186+ sh -x /var/lib/dpkg/info/maas-dns.postinst configure
187+ run-one-until-success maas admin node-group-interface update $CLUSTER_UUID $internal_interface ip_range_low=$dhcp_low ip_range_high=$dhcp_high static_ip_range_low=$static_low static_ip_range_high=$static_high management=2 broadcast_ip=$br0_broadcast router_ip=$router_ip
188+
189+ fi
190+ # Setup nat
191+ # Ensure we have an external connection
192+ orange-box-test-uplink
193+ orange-box-setup-nat
194+
195+ # Setup maas-br0 gateway & DNS
196+ maas admin network update maas-br0 default_gateway=${router_ip} dns_servers="${router_ip} 172.27.252.1"
197+
198+ # Redirect to MAAS web interface
199+ cat >/var/www/html/index.html <<EOF
200+<meta http-equiv="refresh" content="0; url=/MAAS">
201+EOF
202+}
203+
204+# Set MAAS upstream DNS
205+setup_dns() {
206+ # Sets variable for default interface
207+ external_interface=$(ip route ls | grep ^default | awk '{print $5}')
208+ # Sets variable for default DNS acquired via DHCP
209+ #dns=$(nmcli d list iface $external_interface | grep -m 1 "^IP4.DNS" | awk '{ print $2 }')
210+ maas admin maas set-config name=upstream_dns value=172.27.252.1
211+ sed -i -e "/^nameserver ${router_ip}$/d" /etc/resolvconf/resolv.conf.d/head
212+ echo "nameserver ${router_ip}" >> /etc/resolvconf/resolv.conf.d/head
213+ resolvconf -u
214+ sed -e 's/dnssec-validation auto;/dnssec-enable no;dnssec-validation no;/g' -i /etc/bind/named.conf.options
215+}
216+
217+setup_squid() {
218+ maas_ver=$(dpkg -l maas | tail -n1 | awk '{print $3}')
219+ if dpkg --compare-versions $maas_ver lt 1.6; then
220+ # This is now a transparent proxy
221+ if [ -d "/etc/squid-deb-proxy" ]; then
222+ echo > /etc/squid-deb-proxy/squid-deb-proxy.conf
223+ fi
224+ cat /usr/lib/orange-box/inc/squid.conf > /etc/squid3/squid.conf
225+ # Enable squid3, disable squid-deb-proxy
226+ update-rc.d -f squid-deb-proxy remove || true
227+ invoke-rc.d squid-deb-proxy stop || true
228+ # Create directories, if necessary
229+ squid3 -z -N || true
230+ ensure_running squid3
231+ fi
232+ true
233+}
234+
235+# Set up the local mirror
236+setup_local_mirror() {
237+ a2ensite archive
238+ a2ensite ubuntu-cloud
239+ a2dissite 000-default
240+ mkdir -p /srv/mirrors/archive.ubuntu.com
241+ echo '<meta http-equiv="refresh" content="0; url=MAAS/">' > /srv/mirrors/archive.ubuntu.com/index.html
242+ invoke-rc.d apache2 stop || true
243+ invoke-rc.d apache2 start
244+}
245+
246+setup_boot_resources() {
247+ # Importing boot resources
248+ # This might take a long time.
249+ # MAAS won't work very well until this is done, so we're going to block
250+ # until this completes.
251+ orange-box-test-uplink
252+ # Support MAAS 1.5, and newer
253+ maas_ver=$(dpkg -l maas | tail -n1 | awk '{print $3}')
254+ if dpkg --compare-versions $maas_ver lt 1.6; then
255+ cat /usr/lib/orange-box/inc/bootresources_1.5.yaml > /etc/maas/bootresources.yaml
256+ run-this-one maas-import-pxe-files --config-file /etc/maas/bootresources.yaml
257+ else
258+ maas admin boot-resources import
259+ while [ $(maas admin boot-images read $CLUSTER_UUID | wc -l) -lt 10 ]; do
260+ # Waiting for images to download
261+ sleep 10
262+ done
263+ # add precise to the list but don't wait it is not necessary now.
264+ # usual failure is already there..
265+ maas admin boot-source-selections create 1 os="ubuntu" release="precise" arches="amd64" subarches="*" labels="*" || true
266+ maas admin boot-resources import
267+ fi
268+}
269+
270+# Setup Desktop function
271+setup_desktop() {
272+ # Sets background image
273+ sudo -u ubuntu dbus-launch gsettings set org.gnome.desktop.background picture-uri file:///usr/share/orange-box/orange-box-background.png
274+ # Creates Launchers
275+ sudo -u ubuntu dbus-launch gsettings set com.canonical.Unity.Launcher favorites "['firefox.desktop', 'byobu.desktop', 'remmina.desktop']"
276+ # Disable turning off display
277+ sudo -u ubuntu dbus-launch gsettings set org.gnome.desktop.session idle-delay 0
278+ # Disable screen saver
279+ sudo -u ubuntu dbus-launch gsettings set org.gnome.desktop.screensaver idle-activation-enabled false
280+ # Disable screen lock
281+ sudo -u ubuntu dbus-launch gsettings set org.gnome.desktop.screensaver lock-enabled false
282+ if [ -e /etc/lightdm/lightdm.conf ]; then
283+ sed -i -e "/autologin-user=/d" /etc/lightdm/users.conf
284+ echo "autologin-user=ubuntu" >> /etc/lightdm/users.conf
285+ fi
286+
287+ # Disable Ubuntu crash reporter
288+ echo "enabled=0" > /etc/default/apport
289+
290+ # Stop Ubuntu crash reporter
291+ invoke-rc.d apport stop || true
292+}
293+
294+setup_ssh_keys() {
295+ # Disable remote password authentication, since our username/password
296+ # combo is very well known
297+ if ! grep -qs "^PasswordAuthentication no" /etc/ssh/sshd_config 2>/dev/null; then
298+ echo "PasswordAuthentication no" >> /etc/ssh/sshd_config
299+ invoke-rc.d ssh stop || true
300+ invoke-rc.d ssh start
301+ fi
302+ if [ ! -e /home/ubuntu/.ssh/id_rsa ]; then
303+ su -l ubuntu -c "ssh-keygen -N '' -f /home/ubuntu/.ssh/id_rsa"
304+ fi
305+ maas admin sshkeys new key="$(cat /home/ubuntu/.ssh/id_rsa.pub)" || true
306+ if ! grep -qs "^Host.*maas$" /home/ubuntu/.ssh/config; then
307+ cat <<EOF >>/home/ubuntu/.ssh/config
308+
309+Host *.maas
310+UserKnownHostsFile /dev/null
311+StrictHostKeyChecking no
312+CheckHostIP no
313+
314+EOF
315+ fi
316+
317+ # Change permissions of specified file
318+ chmod 600 /home/ubuntu/.ssh/config
319+
320+ # Change ownership of specified file
321+ chown -R ubuntu:ubuntu /home/ubuntu/.ssh/config
322+}
323+
324+setup_juju() {
325+ mkdir -p /home/ubuntu/.juju
326+ cat >/home/ubuntu/.juju/environments.yaml <<EOF
327+default: maas
328+environments:
329+ maas:
330+ type: maas
331+ maas-server: 'http://${router_ip}/MAAS/'
332+ maas-oauth: '$APIKEY'
333+ default-series: trusty
334+ #enable-os-upgrade: false
335+ authorized-keys-path: /home/ubuntu/.ssh/id_rsa.pub
336+ admin-secret: 'admin'
337+ logging-config: '<root>=DEBUG'
338+ lxc-clone: true
339+EOF
340+ rm -rf /home/ubuntu/.juju-plugins
341+ git clone https://github.com/juju/plugins /home/ubuntu/.juju-plugins
342+
343+ # Change ownership recusrively of specified directory
344+ sudo chown -R ubuntu:ubuntu /home/ubuntu/
345+
346+ echo "PATH=\$PATH:/home/ubuntu/.juju-plugins:/home/ubuntu/Examples/bin" >> /home/ubuntu/.bashrc
347+
348+ #Required for local charm deployments to work.
349+ sed -i -e '/^export JUJU_REPOSITORY=/d' /home/ubuntu/.bashrc
350+}
351+
352+ensure_running() {
353+ job="$1"
354+ count=1
355+ while true; do
356+ if (service $job status | grep -qs "running"); then
357+ break
358+ fi
359+ invoke-rc.d $job start
360+ sleep 1
361+ count=$((count+1))
362+ if [ $count -gt $RETRY ]; then
363+ error "[$job] refused to start [$RETRY] times"
364+ fi
365+ done
366+}
367+
368+ensure_running_maas() {
369+ maas_ver=$(dpkg -l maas | tail -n1 | awk '{print $3}')
370+ if dpkg --compare-versions $maas_ver lt 1.6; then
371+ ensure_running maas-region-celery
372+ ensure_running maas-cluster-celery
373+ ensure_running maas-txlongpoll
374+ ensure_running maas-pserv
375+ ensure_running maas-dhcp-server
376+ ensure_running squid3
377+ else
378+ ensure_running apache2
379+ ensure_running maas-clusterd
380+ ensure_running maas-dhcpd
381+ ensure_running maas-proxy
382+ fi
383+
384+ # Stop SCSI Target Framework Daemon
385+ invoke-rc.d tgt stop || true
386+
387+ # Start SCSI Target Framework Daemon
388+ invoke-rc.d tgt start
389+
390+ ensure_running tgt
391+}
392+
393+setup_all_nodes() {
394+ # Ensure that pxe and dhcp are running
395+ ensure_running_maas
396+ maas admin node-groups import-boot-images
397+ orange-box-add-physical-nodes
398+
399+ # Disable VM creation as part of package due to issues
400+ #orange-box-add-virtual-nodes
401+}
402+
403+apply_patches() {
404+ # This is a DISGUSTING HACK that needs to go away
405+ # as soon as MAAS ships these fixes
406+ cd /
407+ cat /usr/lib/orange-box/patches/acquire_languages_none.patch | patch -p0 -N || true
408+ maas_ver=$(dpkg -l maas | tail -n1 | awk '{print $3}')
409+ if dpkg --compare-versions $maas_ver lt 1.6; then
410+ cat /usr/lib/orange-box/patches/arp_ip_order.patch | patch -p0 -N || true
411+ cat /usr/lib/orange-box/patches/try_amt_harder.patch | patch -p0 -N || true
412+ rm -f /usr/lib/python2.7/dist-packages/provisioningserver/utils/__init__.pyc
413+ invoke-rc.d maas-cluster-celery stop || true
414+ invoke-rc.d maas-cluster-celery start
415+ fi
416+ cd -
417+}
418+
419+setup_landscape() {
420+ # The master node will be managed by Landscape
421+ # TODO: this is currently hardcoded to our own landscape account
422+ if which landscape-config; then
423+ case "$(hostname)" in
424+ OrangeBox*|orangebox*)
425+ landscape-config -a canonical-orange -t "$(hostname)__$(dmidecode -s baseboard-serial-number)" -p ubuntu-aubergine --script-users=ALL --silent --include-manager-plugins=ScriptExecution || true
426+ ;;
427+ esac
428+ fi
429+}
430+
431+# Setup Examples function
432+setup_examples() {
433+
434+ # Make directory and create parents as necessary. Do not error if directories already exists.
435+ mkdir -p /home/ubuntu
436+
437+ # If Bazaar directory exist then pull latest copy
438+ if [ -d /home/ubuntu/Examples/.bzr ]; then
439+ bzr pull >/dev/null 2>&1 || true
440+
441+ # Else if Bazaar directory doesn't exist, but Examples folder does then create backup and branch
442+ elif [ -d /home/ubuntu/Examples ]; then
443+ mv -f /home/ubuntu/Examples /home/ubuntu/.Examples
444+ bzr branch lp:orange-box-examples /home/ubuntu/Examples >/dev/null 2>&1 || true
445+
446+ # If Examples directory doesn't exist then branch
447+ else
448+ bzr branch lp:orange-box-examples /home/ubuntu/Examples >/dev/null 2>&1 || true
449+ fi
450+
451+ # Change ownership recursively of specified directory
452+ chown -R ubuntu:ubuntu /home/ubuntu
453+}
454+
455+case "$1" in
456+ configure)
457+ check_orangebox_number
458+ setup_desktop
459+ # Disabled due to fixes being implemented in MAAS
460+ #apply_patches
461+ setup_maas_admin
462+ setup_dns
463+ if [ -n "$2" ]; then
464+ echo
465+ echo "INFO: Skipping importing boot resources, since this is a package upgrade"
466+ echo "INFO: If you want to update boot resources, run:"
467+ echo "INFO: sudo maas-import-pxe-files"
468+ echo "INFO: sudo maas admin node-groups import-boot-images"
469+ echo
470+ else
471+ setup_boot_resources
472+ fi
473+ setup_maas_networking
474+ maas_ver=$(dpkg -l maas | tail -n1 | awk '{print $3}')
475+ if dpkg --compare-versions $maas_ver lt 1.6; then
476+ setup_squid
477+ fi
478+ setup_local_mirror
479+ setup_ssh_keys
480+ setup_juju
481+ if [ -n "$2" ]; then
482+ echo
483+ echo "INFO: Skipping adding all nodes, since this is a package upgrade"
484+ echo "INFO: If you want to delete and add all nodes again, run:"
485+ echo "INFO: sudo orange-box-add-physical-nodes"
486+ echo "INFO: sudo orange-box-add-virtual-nodes"
487+ echo
488+ else
489+ # Only add all nodes and configure landscape on initial install, not upgrades
490+ setup_landscape
491+ setup_all_nodes
492+ fi
493+ setup_examples
494+ ;;
495+ abort-upgrade|abort-remove|abort-deconfigure)
496+ ;;
497+ *)
498+ echo "postinst called with unknown argument \`$1'" >&2
499+ exit 1
500+ ;;
501+esac
502+
503+#DEBHELPER#
504+
505+exit 0
506
507=== removed file 'debian/postinst'
508--- debian/postinst 2014-11-27 23:56:37 +0000
509+++ debian/postinst 1970-01-01 00:00:00 +0000
510@@ -1,310 +0,0 @@
511-#!/bin/sh
512-
513-set -e
514-set -x
515-
516-PKG="orange-box"
517-RETRY=120
518-
519-. /usr/lib/orange-box/inc/common
520-
521-setup_maas_admin() {
522- # Configure the MAAS admin user
523- # Sadly, there's no way to test if the user has been created already,
524- # so ignore errors for idempotence
525- maas-region-admin createadmin --username admin --email maas-admin@example.com --password="admin" 2>/dev/null || true
526- . /etc/maas/maas_cluster.conf
527- APIKEY=$(maas-region-admin apikey --username admin | tail -n1)
528- maas login admin $MAAS_URL $APIKEY
529-}
530-
531-setup_maas_networking() {
532- count=0
533- while ! maas admin node-group-interfaces list $CLUSTER_UUID >/dev/null 2>&1; do
534- count=$((count+1))
535- sleep 1
536- if [ $count -gt $RETRY ]; then
537- error "[maas admin node-group-interfaces list] failed [$RETRY] times"
538- fi
539- done
540- internal_interface=$(route -n | grep "^10\.14\." | sed -e "s/.* //")
541- # Support MAAS 1.5, and 1.6
542- maas_ver=$(dpkg -l maas | tail -n1 | awk '{print $3}')
543- if dpkg --compare-versions $maas_ver lt 1.6; then
544- maas admin node-group-interface update $CLUSTER_UUID $internal_interface ip_range_low=10.14.100.1 ip_range_high=10.14.199.254 management=2 broadcast_ip=10.14.255.255 router_ip=10.14.4.1
545- else
546- sh -x /var/lib/dpkg/info/maas-dns.postinst configure
547- run-one-until-success maas admin node-group-interface update $CLUSTER_UUID $internal_interface ip_range_low=10.14.50.1 ip_range_high=10.14.99.254 static_ip_range_low=10.14.100.1 static_ip_range_high=10.14.199.254 management=2 broadcast_ip=10.14.255.255 router_ip=10.14.4.1
548- fi
549- # Setup nat
550- # Ensure we have an external connection
551- orange-box-test-uplink
552- orange-box-setup-nat
553- # Redirect to MAAS web interface
554- cat >/var/www/html/index.html <<EOF
555-<meta http-equiv="refresh" content="0; url=/MAAS">
556-EOF
557-}
558-
559-setup_dns() {
560- # Set MAAS upstream DNS
561- external_interface=$(ip route ls | grep ^default | awk '{print $5}')
562- dns=$(nmcli d list iface $external_interface | grep -m 1 "^IP4.DNS" | awk '{ print $2 }')
563- maas admin maas set-config name=upstream_dns value=$dns
564- sed -i -e "/^nameserver 10.14.4.1$/d" /etc/resolvconf/resolv.conf.d/head
565- echo "nameserver 10.14.4.1" >> /etc/resolvconf/resolv.conf.d/head
566- resolvconf -u
567- sed -e 's/dnssec-validation auto;/dnssec-enable no;dnssec-validation no;/g' -i /etc/bind/named.conf.options
568-}
569-
570-setup_squid() {
571- maas_ver=$(dpkg -l maas | tail -n1 | awk '{print $3}')
572- if dpkg --compare-versions $maas_ver lt 1.6; then
573- # This is now a transparent proxy
574- if [ -d "/etc/squid-deb-proxy" ]; then
575- echo > /etc/squid-deb-proxy/squid-deb-proxy.conf
576- fi
577- cat /usr/lib/orange-box/inc/squid.conf > /etc/squid3/squid.conf
578- # Disable squid3, enable squid-deb-proxy
579- update-rc.d -f squid-deb-proxy remove || true
580- invoke-rc.d squid-deb-proxy stop || true
581- # Create directories, if necessary
582- squid3 -z -N || true
583- ensure_running squid3
584- fi
585- true
586-}
587-
588-setup_local_mirror() {
589- # Set up the local mirror
590- a2ensite archive
591- a2ensite ubuntu-cloud
592- a2dissite 000-default
593- mkdir -p /srv/mirrors/archive.ubuntu.com
594- echo '<meta http-equiv="refresh" content="0; url=MAAS/">' > /srv/mirrors/archive.ubuntu.com/index.html
595- invoke-rc.d apache2 stop || true
596- invoke-rc.d apache2 start
597- # Sync the charm store to /srv/charmstore
598- # Note: This is going to take a LONG time
599- orange-box-sync-charmstore &
600-}
601-
602-setup_boot_resources() {
603- # Importing boot resources
604- # This might take a long time.
605- # MAAS won't work very well until this is done, so we're going to block
606- # until this completes.
607- orange-box-test-uplink
608- # Support MAAS 1.5, and newer
609- maas_ver=$(dpkg -l maas | tail -n1 | awk '{print $3}')
610- if dpkg --compare-versions $maas_ver lt 1.6; then
611- cat /usr/lib/orange-box/inc/bootresources_1.5.yaml > /etc/maas/bootresources.yaml
612- run-this-one maas-import-pxe-files --config-file /etc/maas/bootresources.yaml
613- else
614- maas admin boot-resources import
615- while [ $(maas admin boot-images read $CLUSTER_UUID | wc -l) -lt 10 ]; do
616- # Waiting for images to download
617- sleep 10
618- done
619- fi
620-}
621-
622-setup_desktop() {
623- sudo -u ubuntu dbus-launch gsettings set org.gnome.desktop.background picture-uri file:///usr/share/orange-box/orange-box-background.png
624- sudo -u ubuntu dbus-launch gsettings set com.canonical.Unity.Launcher favorites "['firefox.desktop', 'byobu.desktop', 'remmina.desktop']"
625- sudo -u ubuntu dbus-launch gsettings set org.gnome.desktop.session idle-delay 999999
626- sudo -u ubuntu dbus-launch gsettings set org.gnome.desktop.screensaver idle-activation-enabled false
627- sudo -u ubuntu dbus-launch gsettings set org.gnome.desktop.screensaver lock-enabled false
628- if [ -e /etc/lightdm/lightdm.conf ]; then
629- sed -i -e "/autologin-user=/d" /etc/lightdm/users.conf
630- echo "autologin-user=ubuntu" >> /etc/lightdm/users.conf
631- fi
632- echo "enabled=0" > /etc/default/apport
633- invoke-rc.d apport stop || true
634-}
635-
636-setup_ssh_keys() {
637- # Disable remote password authentication, since our username/password
638- # combo is very well known
639- if ! grep -qs "^PasswordAuthentication no" /etc/ssh/sshd_config 2>/dev/null; then
640- echo "PasswordAuthentication no" >> /etc/ssh/sshd_config
641- invoke-rc.d ssh stop || true
642- invoke-rc.d ssh start
643- fi
644- if [ ! -e /home/ubuntu/.ssh/id_rsa ]; then
645- su -l ubuntu -c "ssh-keygen -N '' -f /home/ubuntu/.ssh/id_rsa"
646- fi
647- maas admin sshkeys new key="$(cat /home/ubuntu/.ssh/id_rsa.pub)" || true
648- if ! grep -qs "^Host.*maas$" /home/ubuntu/.ssh/config; then
649- cat <<EOF >>/home/ubuntu/.ssh/config
650-
651-Host *.maas
652-UserKnownHostsFile /dev/null
653-StrictHostKeyChecking no
654-CheckHostIP no
655-
656-EOF
657- fi
658- chmod 600 /home/ubuntu/.ssh/config
659- chown -R ubuntu:ubuntu /home/ubuntu/.ssh/config
660-}
661-
662-setup_juju() {
663- mkdir -p /home/ubuntu/.juju
664- cat >/home/ubuntu/.juju/environments.yaml <<EOF
665-default: maas
666-environments:
667- maas:
668- type: maas
669- maas-server: 'http://10.14.4.1/MAAS/'
670- maas-oauth: '$APIKEY'
671- default-series: trusty
672- #enable-os-upgrade: false
673- authorized-keys-path: /home/ubuntu/.ssh/id_rsa.pub
674- admin-secret: 'admin'
675- logging-config: '<root>=DEBUG'
676- lxc-clone: true
677-EOF
678- rm -rf /home/ubuntu/.juju-plugins
679- git clone https://github.com/juju/plugins /home/ubuntu/.juju-plugins
680- sudo chown -R ubuntu:ubuntu /home/ubuntu/
681- echo "PATH=\$PATH:/home/ubuntu/.juju-plugins:/home/ubuntu/Examples/bin" >> /home/ubuntu/.bashrc
682- #Required for local charm deployments to work.
683- sed -i -e '/^export JUJU_REPOSITORY=/d' /home/ubuntu/.bashrc
684- echo "export JUJU_REPOSITORY=/srv/charmstore" >> /home/ubuntu/.bashrc
685-}
686-
687-ensure_running() {
688- job="$1"
689- count=1
690- while true; do
691- if (service $job status | grep -qs "running"); then
692- break
693- fi
694- invoke-rc.d $job start
695- sleep 1
696- count=$((count+1))
697- if [ $count -gt $RETRY ]; then
698- error "[$job] refused to start [$RETRY] times"
699- fi
700- done
701-}
702-
703-ensure_running_maas() {
704- maas_ver=$(dpkg -l maas | tail -n1 | awk '{print $3}')
705- if dpkg --compare-versions $maas_ver lt 1.6; then
706- ensure_running maas-region-celery
707- ensure_running maas-cluster-celery
708- ensure_running maas-txlongpoll
709- ensure_running maas-pserv
710- ensure_running maas-dhcp-server
711- ensure_running squid3
712- else
713- ensure_running apache2
714- ensure_running maas-clusterd
715- ensure_running maas-dhcpd
716- ensure_running maas-proxy
717- fi
718- invoke-rc.d tgt stop || true
719- invoke-rc.d tgt start
720- ensure_running tgt
721-}
722-
723-setup_all_nodes() {
724- # Ensure that pxe and dhcp are running
725- ensure_running_maas
726- maas admin node-groups import-boot-images
727- orange-box-add-physical-nodes
728- orange-box-add-virtual-nodes
729-}
730-
731-apply_patches() {
732- # This is a DISGUSTING HACK that needs to go away
733- # as soon as MAAS ships these fixes
734- cd /
735- cat /usr/lib/orange-box/patches/acquire_languages_none.patch | patch -p0 -N || true
736- maas_ver=$(dpkg -l maas | tail -n1 | awk '{print $3}')
737- if dpkg --compare-versions $maas_ver lt 1.6; then
738- cat /usr/lib/orange-box/patches/arp_ip_order.patch | patch -p0 -N || true
739- cat /usr/lib/orange-box/patches/try_amt_harder.patch | patch -p0 -N || true
740- rm -f /usr/lib/python2.7/dist-packages/provisioningserver/utils/__init__.pyc
741- invoke-rc.d maas-cluster-celery stop || true
742- invoke-rc.d maas-cluster-celery start
743- fi
744- cd -
745-}
746-
747-setup_landscape() {
748- # The master node will be managed by Landscape
749- # TODO: this is currently hardcoded to our own landscape account
750- if which landscape-config; then
751- case "$(hostname)" in
752- OrangeBox*|orangebox*)
753- landscape-config -a canonical-orange -t "$(hostname)__$(dmidecode -s baseboard-serial-number)" -p ubuntu-aubergine --script-users=ALL --silent --include-manager-plugins=ScriptExecution || true
754- ;;
755- esac
756- fi
757-}
758-
759-setup_examples() {
760- mkdir -p /home/ubuntu
761- if [ -d /home/ubuntu/Examples/.bzr ]; then
762- bzr pull >/dev/null 2>&1 || true
763- elif [ -d /home/ubuntu/Examples ]; then
764- mv -f /home/ubuntu/Examples /home/ubuntu/.Examples
765- bzr branch lp:orange-box-examples /home/ubuntu/Examples >/dev/null 2>&1 || true
766- else
767- bzr branch lp:orange-box-examples /home/ubuntu/Examples >/dev/null 2>&1 || true
768- fi
769- chown -R ubuntu:ubuntu /home/ubuntu
770-}
771-
772-case "$1" in
773- configure)
774- setup_desktop
775- apply_patches
776- setup_maas_admin
777- setup_dns
778- if [ -n "$2" ]; then
779- echo
780- echo "INFO: Skipping importing boot resources, since this is a package upgrade"
781- echo "INFO: If you want to update boot resources, run:"
782- echo "INFO: sudo maas-import-pxe-files"
783- echo "INFO: sudo maas admin node-groups import-boot-images"
784- echo
785- else
786- setup_boot_resources
787- fi
788- setup_maas_networking
789- maas_ver=$(dpkg -l maas | tail -n1 | awk '{print $3}')
790- if dpkg --compare-versions $maas_ver lt 1.6; then
791- setup_squid
792- fi
793- setup_local_mirror
794- setup_ssh_keys
795- setup_juju
796- if [ -n "$2" ]; then
797- echo
798- echo "INFO: Skipping adding all nodes, since this is a package upgrade"
799- echo "INFO: If you want to delete and add all nodes again, run:"
800- echo "INFO: sudo orange-box-add-physical-nodes"
801- echo "INFO: sudo orange-box-add-virtual-nodes"
802- echo
803- else
804- # Only add all nodes and configure landscape on initial install, not upgrades
805- setup_landscape
806- setup_all_nodes
807- fi
808- setup_examples
809- ;;
810- abort-upgrade|abort-remove|abort-deconfigure)
811- ;;
812- *)
813- echo "postinst called with unknown argument \`$1'" >&2
814- exit 1
815- ;;
816-esac
817-
818-#DEBHELPER#
819-
820-exit 0
821
822=== added file 'debian/postrm'
823--- debian/postrm 1970-01-01 00:00:00 +0000
824+++ debian/postrm 2015-07-23 19:54:40 +0000
825@@ -0,0 +1,23 @@
826+#!/bin/sh
827+
828+set -e
829+
830+webserver="apache2"
831+
832+case "$1" in
833+ remove)
834+ for i in archive ubuntu-cloud; do
835+ if [ -e "/etc/apache2/sites-enabled/${i}.conf" ]; then
836+ a2dissite $i
837+ fi
838+ done
839+ invoke-rc.d $webserver reload
840+ rm -f /var/log/orange-box-mirror.log
841+ rm -rf /etc/maas
842+ rm -rf /var/lib/orange-box
843+ ;;
844+esac
845+
846+#DEBHELPER#
847+
848+exit 0
849
850=== removed file 'debian/postrm'
851--- debian/postrm 2014-07-17 04:12:46 +0000
852+++ debian/postrm 1970-01-01 00:00:00 +0000
853@@ -1,23 +0,0 @@
854-#!/bin/sh
855-
856-set -e
857-
858-webserver="apache2"
859-
860-case "$1" in
861- remove)
862- for i in archive ubuntu-cloud; do
863- if [ -e "/etc/apache2/sites-enabled/${i}.conf" ]; then
864- a2dissite $i
865- fi
866- done
867- invoke-rc.d $webserver reload
868- rm -f /var/log/orange-box-mirror.log
869- rm -rf /etc/maas
870- rm -rf /var/lib/orange-box
871- ;;
872-esac
873-
874-#DEBHELPER#
875-
876-exit 0
877
878=== added file 'debian/preinst'
879--- debian/preinst 1970-01-01 00:00:00 +0000
880+++ debian/preinst 2015-07-23 19:54:40 +0000
881@@ -0,0 +1,174 @@
882+#!/bin/sh
883+set -e
884+set -x
885+
886+get_orangebox_number() {
887+## assume hostname as been set correctly .. will be checked in postinst
888+OBNum=`hostname | cut -c 10- -`
889+echo $OBNum
890+echo "orangebox_number=$OBNum" > /etc/orange-box.conf
891+}
892+
893+### According to OB networking re-design
894+orangebox_number=`get_orangebox_number`
895+default_maas_ip=172.27.${orangebox_number}.1
896+gateway_ip=172.27.252.1
897+external_ip=172.27.252.${orangebox_number}
898+internal_ip=172.27.${orangebox_number}.1
899+br0_broadcast=172.27.`expr ${orangebox_number} + 3`.255
900+
901+preflight_checks() {
902+ if [ "$(id -u ubuntu)" != "1000" ]; then
903+ echo "ERROR: Read the docs; a proper OrangeBox setup requires the default user to be [ubuntu]" 1>&2
904+ exit 1
905+ fi
906+
907+ # Ensure em1 is the correct name (disabled due to issues)
908+ # biosdevname -i eth1 || (echo "biosdevname should have been run already assume it does"; true)
909+
910+ # TODO: Check that the AMTs are on static IPs
911+ # TODO: Check dual hard drives, which one is which
912+ # TODO: Ensure we have two interfaces, one internal, one external
913+}
914+
915+setup_debconf() {
916+ echo "debconf maas/default-maas-url string $default_maas_ip" | debconf-set-selections -
917+ echo "debconf maas-cluster-controller/maas-url string http://${default_maas_ip}/MAAS" | debconf-set-selections -
918+ echo "debconf maas/installation-note boolean true" | debconf-set-selections -
919+ echo "debconf iptables-persistent/autosave_done boolean true" | debconf-set-selections -
920+ echo "debconf iptables-persistent/autosave_v4 boolean true" | debconf-set-selections -
921+ echo "debconf iptables-persistent/autosave_v6 boolean true" | debconf-set-selections -
922+}
923+
924+setup_networking() {
925+ # Configure interface as VLAN trunk
926+ modprobe 8021q || true
927+ sed -i -e "/8021q/d" /etc/modules || true
928+ echo "8021q" >> /etc/modules
929+ # Set up the two network interfaces
930+ external_interface=$(ip route ls | grep ^default | awk '{print $5}')
931+ # TODO: ip addr ls
932+ for interface in $(ifconfig -a -s | grep -v ^Iface | awk '{print $1}'); do
933+ case "$interface" in
934+ lo|br*|wlan*|vnet*)
935+ continue
936+ ;;
937+ $external_interface)
938+ continue
939+ ;;
940+ *)
941+ internal_interface="$interface"
942+ break
943+ ;;
944+ esac
945+ done
946+
947+ # Reverted to eth0 due to issues
948+ # Set a sane default as em1 because the biosdevname should have been installed and run
949+ [ -z "$internal_interface" ] && internal_interface=eth0
950+
951+ # TODO: use ip
952+ default_mac=$(ifconfig "$internal_interface" | grep "^$internal_interface" | sed -e "s/.*HWaddr //")
953+
954+ # Tell NetworkManager to piss off
955+ sed -i -e "/^unmanaged-devices=mac:$default_mac$/d" /etc/NetworkManager/NetworkManager.conf
956+ cat >>/etc/NetworkManager/NetworkManager.conf <<EOF
957+[keyfile]
958+unmanaged-devices=mac:$default_mac
959+EOF
960+ invoke-rc.d network-manager stop || true
961+ invoke-rc.d network-manager start
962+ cat >/etc/network/interfaces <<EOF
963+auto lo
964+iface lo inet loopback
965+
966+auto $external_interface
967+iface $external_interface inet static
968+ address ${external_ip}
969+ netmask 255.255.252.0
970+ broadcast 172.27.255.255
971+ gateway ${gateway_ip}
972+ dns-nameservers ${external_ip} ${gateway_ip}
973+
974+auto $internal_interface
975+iface $internal_interface inet manual
976+
977+auto br0
978+iface br0 inet static
979+ address ${internal_ip}
980+ netmask 255.255.252.0
981+ broadcast $br0_broadcast
982+ bridge_ports $internal_interface
983+ bridge_stp off
984+ bridge_fd 0
985+ bridge_maxwait 0
986+
987+# VLAN 2, Uplink network
988+iface ${internal_interface}.2 inet dhcp
989+vlan-raw-device $internal_interface
990+
991+# Network management alias
992+iface br0:1 inet static
993+address 10.90.90.91
994+netmask 255.255.255.0
995+broadcast 10.90.90.255
996+
997+EOF
998+ # Take internal interface down
999+ ifdown --force $internal_interface || true
1000+ # Take down br0 interface
1001+ ifdown --force br0 || true
1002+ # Bring up internal interface
1003+ ifup $internal_interface
1004+ # Bring up br0 interface
1005+ ifup br0
1006+ # Take down external interface
1007+ ifdown --force $external_interface || true
1008+ # Bring up external interface
1009+ ifup $external_interface
1010+
1011+ # Wait a moment for the network to normalize
1012+ echo "INFO: Ensure networking has settled"
1013+ run-one-until-success ping -c 10 maas.ubuntu.com
1014+}
1015+
1016+setup_external_drive() {
1017+ # External drive must be:
1018+ # a) partitioned into 1 big partition
1019+ # b) ext4 formatted
1020+ # Find root disk
1021+ root_disk=$(mount | grep " on / " | awk '{print $1}' | sed -e "s/[0-9]\+$//")
1022+ # Find biggest non-root disk
1023+ ext_disk=$(fdisk -l | grep "^Disk /" | grep -v $root_disk | sort -k4 -n -r | awk '{print $2}' | awk -F: '{print $1}')
1024+ partition="${ext_disk}1"
1025+ if [ -b "$ext_disk" ]; then
1026+ if [ ! -b "$partition" ]; then
1027+ # Create the partition, if it doesn't exist already
1028+ echo "n
1029+p
1030+1
1031+
1032+
1033+w
1034+"|fdisk "$ext_disk"
1035+ mkfs.ext4 "$partition"
1036+ fi
1037+ sed -i -e "/ \/srv/d" /etc/fstab
1038+ # Add the fstab entry
1039+ uuid=$(blkid -s UUID -o value "$partition")
1040+ echo "UUID=$uuid /srv ext4 defaults 1 1" >> /etc/fstab
1041+ fi
1042+ umount $partition || true
1043+ mount -a
1044+ chown root:root /srv
1045+ chmod 755 /srv
1046+}
1047+
1048+preflight_checks
1049+setup_external_drive
1050+setup_debconf
1051+setup_networking
1052+
1053+#DEBHELPER#
1054+
1055+exit 0
1056
1057=== removed file 'debian/preinst'
1058--- debian/preinst 2014-08-25 14:32:16 +0000
1059+++ debian/preinst 1970-01-01 00:00:00 +0000
1060@@ -1,136 +0,0 @@
1061-#!/bin/sh
1062-set -e
1063-set -x
1064-
1065-#unnecessary comment
1066-
1067-preflight_checks() {
1068- if [ "$(id -u ubuntu)" != "1000" ]; then
1069- echo "ERROR: Read the docs; a proper OrangeBox setup requires the default user to be [ubuntu]" 1>&2
1070- exit 1
1071- fi
1072- # TODO: Check that the AMTs are on static IPs
1073- # TODO: Check dual hard drives, which one is which
1074- # TODO: Ensure we have two interfaces, one internal, one external
1075-}
1076-
1077-setup_debconf() {
1078- echo "debconf maas/default-maas-url string 10.14.4.1" | debconf-set-selections -
1079- echo "debconf maas-cluster-controller/maas-url string http://10.14.4.1/MAAS" | debconf-set-selections -
1080- echo "debconf maas/installation-note boolean true" | debconf-set-selections -
1081- echo "debconf iptables-persistent/autosave_done boolean true" | debconf-set-selections -
1082- echo "debconf iptables-persistent/autosave_v4 boolean true" | debconf-set-selections -
1083- echo "debconf iptables-persistent/autosave_v6 boolean true" | debconf-set-selections -
1084-}
1085-
1086-setup_networking() {
1087- modprobe 8021q || true
1088- sed -i -e "/8021q/d" /etc/modules || true
1089- echo "8021q" >> /etc/modules
1090- # Set up the two network interfaces
1091- external_interface=$(ip route ls | grep ^default | awk '{print $5}')
1092- # TODO: ip addr ls
1093- for interface in $(ifconfig -a -s | grep -v ^Iface | awk '{print $1}'); do
1094- case "$interface" in
1095- lo|br*|wlan*)
1096- continue
1097- ;;
1098- $external_interface)
1099- continue
1100- ;;
1101- *)
1102- internal_interface="$interface"
1103- break
1104- ;;
1105- esac
1106- done
1107- # Set a sane default
1108- [ -z "$internal_interface" ] && internal_interface=eth0
1109- # TODO: use ip
1110- default_mac=$(ifconfig "$internal_interface" | grep "^$internal_interface" | sed -e "s/.*HWaddr //")
1111- # Tell NetworkManager to piss off
1112- sed -i -e "/^unmanaged-devices=mac:$default_mac$/d" /etc/NetworkManager/NetworkManager.conf
1113- cat >>/etc/NetworkManager/NetworkManager.conf <<EOF
1114-[keyfile]
1115-unmanaged-devices=mac:$default_mac
1116-EOF
1117- invoke-rc.d network-manager stop || true
1118- invoke-rc.d network-manager start
1119- cat >/etc/network/interfaces <<EOF
1120-auto lo
1121-iface lo inet loopback
1122-
1123-auto $internal_interface
1124-iface $internal_interface inet manual
1125-
1126-auto br0
1127-iface br0 inet static
1128- address 10.14.4.1
1129- netmask 255.255.0.0
1130- broadcast 10.14.255.255
1131- bridge_ports $internal_interface
1132- bridge_stp off
1133- bridge_fd 0
1134- bridge_maxwait 0
1135-
1136-# VLAN 2, Uplink network
1137-iface eth0.2 inet dhcp
1138-vlan-raw-device eth0
1139-
1140-# Network management alias
1141-iface br0:1 inet static
1142-address 10.90.90.91
1143-netmask 255.255.255.0
1144-broadcast 10.90.90.255
1145-
1146-EOF
1147- ifdown --force $internal_interface || true
1148- ifdown --force br0 || true
1149- ifup $internal_interface
1150- ifup br0
1151- # Wait a moment for the network to normalize
1152- echo "INFO: Ensure networking has settled"
1153- run-one-until-success ping -c 10 maas.ubuntu.com
1154-}
1155-
1156-setup_external_drive() {
1157- # External drive must be:
1158- # a) partitioned into 1 big partition
1159- # b) ext4 formatted
1160- # Find root disk
1161- root_disk=$(mount | grep " on / " | awk '{print $1}' | sed -e "s/[0-9]\+$//")
1162- # Find biggest non-root disk
1163- ext_disk=$(fdisk -l | grep "^Disk /" | grep -v $root_disk | sort -k4 -n -r | awk '{print $2}' | awk -F: '{print $1}')
1164- partition="${ext_disk}1"
1165- if [ -b "$ext_disk" ]; then
1166- if [ ! -b "$partition" ]; then
1167- # Create the partition, if it doesn't exist already
1168- echo "n
1169-p
1170-1
1171-
1172-
1173-w
1174-"|fdisk "$ext_disk"
1175- mkfs.ext4 "$partition"
1176- fi
1177- sed -i -e "/ \/srv/d" /etc/fstab
1178- # Add the fstab entry
1179- uuid=$(blkid -s UUID -o value "$partition")
1180- echo "UUID=$uuid /srv ext4 defaults 1 1" >> /etc/fstab
1181- fi
1182- umount $partition || true
1183- mount -a
1184- chown root:root /srv
1185- chmod 755 /srv
1186-}
1187-
1188-
1189-preflight_checks
1190-setup_external_drive
1191-setup_debconf
1192-setup_networking
1193-
1194-#DEBHELPER#
1195-
1196-exit 0
1197
1198=== modified file 'debian/source/format'
1199--- debian/source/format 2014-04-04 19:40:10 +0000
1200+++ debian/source/format 2015-07-23 19:54:40 +0000
1201@@ -1,1 +1,1 @@
1202-3.0 (quilt)
1203+3.0 (native)
1204
1205=== modified file 'etc/apt/orange-box-mirror.list'
1206--- etc/apt/orange-box-mirror.list 2015-01-21 22:04:42 +0000
1207+++ etc/apt/orange-box-mirror.list 2015-07-23 19:54:40 +0000
1208@@ -8,7 +8,7 @@
1209 set var_path $base_path/var
1210 set cleanscript /bin/true
1211 set defaultarch amd64
1212-set postmirror_script /bin/true
1213+# set postmirror_script $var_path/postmirror.sh
1214 # set run_postmirror 0
1215 set nthreads 20
1216 set _tilde 0
1217
1218=== modified file 'usr/bin/orange-box-add-node'
1219--- usr/bin/orange-box-add-node 2014-10-27 20:54:45 +0000
1220+++ usr/bin/orange-box-add-node 2015-07-23 19:54:40 +0000
1221@@ -23,6 +23,9 @@
1222 set -e
1223 set -x
1224
1225+## According to OB network re-design
1226+. /etc/orange-box.conf
1227+
1228 ip_to_mac() {
1229 local ip="$1"
1230 arp -n | sort | grep -m1 "^$ip\s" | awk '{print $3}'
1231@@ -31,7 +34,7 @@
1232 node_name() {
1233 local num="${1##*.}"
1234 num=$((num-10))
1235- echo "node${num}"
1236+ echo "node${num}ob${orangebox_number}"
1237 }
1238
1239 hostname_to_system_id() {
1240@@ -60,20 +63,20 @@
1241 maas admin zone read zone2 || maas admin zones create name=zone2 description="Physical machines on right side of Orange Box"
1242
1243 #Create maas-br0 network if it does not already exist
1244-maas admin network read maas-br0 || maas admin networks create name=maas-br0 ip=10.14.0.0 netmask=255.255.0.0 default_gateway=10.14.4.1 dns_servers=10.14.4.1 description="Auto created when running orange-box-add-node"
1245+maas admin network read maas-br0 || maas admin networks create name=maas-br0 ip=172.27.${orangebox_number}.0 netmask=255.255.252.0 default_gateway=172.27.${orangebox_number}.1 dns_servers=172.27.${orangebox_number}.1 description="Auto created when running orange-box-add-node"
1246
1247 # Loop over the list of ip addresses listening on 16992
1248 for ip in $@; do
1249 mac=$(ip_to_mac $ip)
1250 hostname=$(node_name $ip)
1251- node=${hostname#node}
1252+ node=`echo ${hostname}| sed "s/node\(.*\)ob${orangebox_number}/\1/"`
1253 if [ $node -lt 5 ]; then
1254 zone="zone1"
1255 else
1256 zone="zone2"
1257 fi
1258 info "$ip --> $hostname --> $mac"
1259- if [ -z "$ip" ] || [ "$ip" = "10.14.4.1" ]; then
1260+ if [ -z "$ip" ] || [ "$ip" = "172.27.${orangebox_number}.1" ]; then
1261 continue
1262 fi
1263 # Remove it, if it's already here
1264
1265=== modified file 'usr/bin/orange-box-add-physical-nodes'
1266--- usr/bin/orange-box-add-physical-nodes 2014-07-11 18:27:46 +0000
1267+++ usr/bin/orange-box-add-physical-nodes 2015-07-23 19:54:40 +0000
1268@@ -25,11 +25,16 @@
1269
1270 oauth_login
1271
1272+## According to OB network re-design
1273+. /etc/orange-box.conf
1274+
1275+
1276+
1277 # Search for nodes listening on AMT's 16992
1278 info "Searching for all nodes on the local network listening on 16992; this will take 60 seconds...."
1279-ips=$(time for i in $(seq 1 10); do nmap -p 16992 -oG - 10.14.4.1/24 | grep 16992/open | awk '{print $2}' ; done | sort -u -r)
1280+ips=$(time for i in $(seq 1 10); do nmap -p 16992 -oG - 172.27.${orangebox_number}.1/22 | grep 16992/open | awk '{print $2}' ; done | sort -u -r)
1281 if [ -z "$ips" ]; then
1282- error "nmap did not find any nodes listening on [16992] on the [10.14.4.1/24] network"
1283+ error "nmap did not find any nodes listening on [16992] on the [172.27.${orangebox_number}.1/22] network"
1284 fi
1285 info "Found: [$ips]"
1286
1287
1288=== removed file 'usr/bin/orange-box-add-virtual-nodes'
1289--- usr/bin/orange-box-add-virtual-nodes 2015-02-07 16:07:08 +0000
1290+++ usr/bin/orange-box-add-virtual-nodes 1970-01-01 00:00:00 +0000
1291@@ -1,93 +0,0 @@
1292-#!/bin/bash
1293-#
1294-# orange-box-setup-kvms - create some virtual machines
1295-# Copyright (C) 2014 Canonical Ltd.
1296-#
1297-# Authors: Ronald McCollam <ronald.mccollam@canonical.com>
1298-# Dustin Kirkland <kirkland@canonical.com>
1299-#
1300-# This program is free software: you can redistribute it and/or modify
1301-# it under the terms of the GNU General Public License as published by
1302-# the Free Software Foundation, version 3 of the License.
1303-#
1304-# This program is distributed in the hope that it will be useful,
1305-# but WITHOUT ANY WARRANTY; without even the implied warranty of
1306-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1307-# GNU General Public License for more details.
1308-#
1309-# You should have received a copy of the GNU General Public License
1310-# along with this program. If not, see <http://www.gnu.org/licenses/>.
1311-
1312-
1313-if [ "$(id -u)" != "0" ]; then
1314- echo "Must be run with sudo or by root"
1315- exit 77
1316-fi
1317-
1318-set -e
1319-set -x
1320-
1321-virsh net-info default && virsh net-destroy default && virsh net-undefine default
1322-
1323-[ -d ~maas ] || install -d /var/lib/maas --owner maas --group maas
1324-chsh maas -s /bin/bash
1325-[ -d ~maas/.ssh ] || echo -e "\n\n\n" | sudo -u maas ssh-keygen -N "" -t rsa -f ~maas/.ssh/id_rsa
1326-grep 'maas@' /home/ubuntu/.ssh/authorized_keys || cat ~maas/.ssh/id_rsa.pub | tee -a /home/ubuntu/.ssh/authorized_keys
1327-printf "%s,%s %s %s\n" "node0.maas" "10.14.4.1" $(awk '{print $1 " " $2}' /etc/ssh/ssh_host_ecdsa_key.pub) | tee -a ~maas/.ssh/known_hosts
1328-chown -R ubuntu:ubuntu /home/ubuntu
1329-
1330-maas admin tags new name=virtual || true
1331-maas admin tags new name=bootstrap || true
1332-maas admin tags new name=neutron || true
1333-
1334-# Mark all nodes to be fast path installed
1335-# Support MAAS 1.5, and 1.6
1336-maas_ver=$(dpkg -l maas | tail -n1 | awk '{print $3}')
1337-if dpkg --compare-versions $maas_ver lt 1.6; then
1338- maas admin tags new name='use-fastpath-installer' comment='fp' "definition=true()" || true
1339-else
1340- maas admin tags new name='use-fastpath-installer' comment='fp' || true
1341-fi
1342-
1343-#Create zone0 for virtual nodes
1344-maas admin zone read zone0 || maas admin zones create name=zone0 description="Virtual machines on node0"
1345-
1346-#Create maas-br0 network if it does not already exist
1347-maas admin network read maas-br0 || maas admin networks create name=maas-br0 ip=10.14.0.0 netmask=255.255.0.0 default_gateway=10.14.4.1 dns_servers=10.14.4.1 description="Auto created when running orange-box-add-virtual-nodes"
1348-
1349-for i in $(seq 0 2 | sort -r); do
1350- hostname="node0vm${i}.maas"
1351- virsh destroy $hostname || true
1352- virsh undefine $hostname || true
1353- echo "INFO: Installing virtual machine"
1354- virt-install --debug --name $hostname --ram 4096 --disk=path=/var/lib/orange-box/${hostname}-1.img,size=20 --disk=path=/var/lib/orange-box/${hostname}-2.img,size=2 --vcpus=2 --os-type=linux --pxe --network=bridge=br0,model=virtio --network=bridge=br0,model=rtl8139 --boot network --video=cirrus --graphics vnc|| true
1355- virsh console $hostname || true
1356- #Workaround for bug: https://bugs.launchpad.net/maas/+bug/1367482
1357- virsh dumpxml $hostname > /tmp/${hostname}.xml
1358- sed -i -e "s#<model type='rtl8139'/>#<model type='rtl8139'/> <rom file=''/>#" /tmp/${hostname}.xml
1359- virsh define /tmp/${hostname}.xml
1360- virsh autostart $hostname
1361- mac=$(virsh dumpxml $hostname | python -c 'import sys, lxml.etree; print list(lxml.etree.parse(sys.stdin).iter("mac"))[0].get("address")')
1362- mac2=$(virsh dumpxml $hostname | python -c 'import sys, lxml.etree; print list(lxml.etree.parse(sys.stdin).iter("mac"))[0].get("address")')
1363- system_id=$(maas admin nodes list mac_address=$mac | grep system_id | cut -d'"' -f4)
1364- if [ -n "$system_id" ]; then
1365- maas admin node update $system_id hostname=$hostname power_type=virsh power_parameters_power_address=qemu+ssh://ubuntu@10.14.4.1/system power_parameters_power_id=$hostname
1366- maas admin tag update-nodes "virtual" add=$system_id
1367- case $i in
1368- 0)
1369- maas admin tag update-nodes "bootstrap" add=$system_id
1370- ;;
1371- 1)
1372- maas admin tag update-nodes "neutron" add=$system_id
1373- ;;
1374- esac
1375- maas admin tag update-nodes use-fastpath-installer add=$system_id
1376- maas admin node commission $system_id || true
1377- maas admin nodes set-zone zone=zone0 nodes=$system_id
1378- maas admin network connect-macs maas-br0 macs=$mac
1379- maas admin network connect-macs maas-br0 macs=$mac2
1380- else
1381- echo "ERROR: Could not find virtual machine in MAAS" 1>&2
1382- exit 1
1383- fi
1384-done
1385
1386=== modified file 'usr/bin/orange-box-amt-monitor'
1387--- usr/bin/orange-box-amt-monitor 2014-04-16 22:26:52 +0000
1388+++ usr/bin/orange-box-amt-monitor 2015-07-23 19:54:40 +0000
1389@@ -1,3 +1,5 @@
1390 #!/bin/sh
1391
1392-watch -n 10 "sudo nmap -p 16992 -oG - 10.14.4.1/24 | grep 16992/open | sort"
1393+. /etc/orange-box.conf
1394+watch -n 10 "sudo nmap -p 16992 -oG - 172.27.${orangebox_number}.0/22 | grep 16992/open | sort"
1395+
1396
1397=== removed file 'usr/bin/orange-box-apm-power-fix'
1398--- usr/bin/orange-box-apm-power-fix 2014-10-31 09:19:40 +0000
1399+++ usr/bin/orange-box-apm-power-fix 1970-01-01 00:00:00 +0000
1400@@ -1,38 +0,0 @@
1401-#!/bin/sh
1402-#
1403-# orange-box-apm-power-fix - fix for issue with orange-box-apm-power
1404-# Copyright (C) 2014 Canonical Ltd.
1405-#
1406-# Authors: Darryl Weaver <darryl.weaver@canonical.com>
1407-#
1408-# This program is free software: you can redistribute it and/or modify
1409-# it under the terms of the GNU General Public License as published by
1410-# the Free Software Foundation, version 3 of the License.
1411-#
1412-# This program is distributed in the hope that it will be useful,
1413-# but WITHOUT ANY WARRANTY; without even the implied warranty of
1414-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1415-# GNU General Public License for more details.
1416-#
1417-# You should have received a copy of the GNU General Public License
1418-# along with this program. If not, see <http://www.gnu.org/licenses/>.
1419-
1420-set -x
1421-
1422-if [ ! -f /var/lib/maas/boot-resources/current/syslinux/poweroff-APM.com ]
1423-then
1424-cd /srv/data
1425-wget https://launchpadlibrarian.net/187530745/acpioff.c32
1426-cd /var/lib/maas/boot-resources/current/syslinux
1427-sudo mv poweroff.com poweroff-APM.com
1428-sudo mv /srv/data/acpioff.c32 poweroff.c32
1429-fi
1430-
1431-#fixing the AMT template
1432-cd /srv/data
1433-wget https://launchpadlibrarian.net/187911231/not-permitted.patch
1434-cd /etc/maas/templates/power
1435-patch < /srv/data/not-permitted.patch
1436-
1437-exit
1438-
1439
1440=== removed file 'usr/bin/orange-box-bootstrap-juju'
1441--- usr/bin/orange-box-bootstrap-juju 2015-01-07 23:15:31 +0000
1442+++ usr/bin/orange-box-bootstrap-juju 1970-01-01 00:00:00 +0000
1443@@ -1,31 +0,0 @@
1444-#!/bin/sh
1445-#
1446-# orange-box-bootstrap-juju - bootstrap Juju to one vm
1447-# Copyright (C) 2014 Canonical Ltd.
1448-#
1449-# Authors: Dustin Kirkland <kirkland@canonical.com>
1450-#
1451-# This program is free software: you can redistribute it and/or modify
1452-# it under the terms of the GNU General Public License as published by
1453-# the Free Software Foundation, version 3 of the License.
1454-#
1455-# This program is distributed in the hope that it will be useful,
1456-# but WITHOUT ANY WARRANTY; without even the implied warranty of
1457-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1458-# GNU General Public License for more details.
1459-#
1460-# You should have received a copy of the GNU General Public License
1461-# along with this program. If not, see <http://www.gnu.org/licenses/>.
1462-
1463-set -x
1464-
1465-tcp_connect() {
1466- info "Trying TCP [$@] ... "
1467- timeout 1m run-one-until-success nc -w 10 -zvv $@ 2>&1
1468-}
1469-
1470-juju status && echo "Existing deployment found, exiting." && exit 0
1471-juju bootstrap --to node0vm0.maas --show-log --upload-tools
1472-juju set-constraints "tags="
1473-juju deploy --to 0 --repository=/srv/charmstore/ local:trusty/juju-gui
1474-juju expose juju-gui
1475
1476=== modified file 'usr/bin/orange-box-create-package-mirror'
1477--- usr/bin/orange-box-create-package-mirror 2015-01-21 22:04:42 +0000
1478+++ usr/bin/orange-box-create-package-mirror 2015-07-23 19:54:40 +0000
1479@@ -27,7 +27,9 @@
1480 fi
1481
1482 home=$PWD
1483-IP=10.14.4.1
1484+. /etc/orange-box.conf
1485+
1486+IP=172.27.${orangebox_number}.1
1487
1488 function run_mirror {
1489 echo "apt-mirror /etc/apt/orange-box-mirror.list >>/var/log/orange-box-mirror.log 2>&1"
1490@@ -95,6 +97,17 @@
1491 echo Making mirror directories ...
1492 mkdir -p /srv/mirrors /srv/skel /srv/var
1493
1494+echo Creating postmirror.sh script ...
1495+# This created a blank file, for some reason :/
1496+echo << 'EOF' > /srv/var/postmirror.sh
1497+#!/bin/sh
1498+/srv/var/clean.sh
1499+EOF
1500+
1501+echo Making postmirror.sh executable ...
1502+chmod +x /srv/var/postmirror.sh
1503+echo Done. && echo
1504+
1505 echo Setting up the web dirs for mirroring ...
1506 ln -s /srv/mirrors/archive.ubuntu.com/ubuntu /var/www/html/archive.ubuntu.com
1507 ln -s /srv/mirrors/ubuntu-cloud.archive.canonical.com/ubuntu /var/www/html/ubuntu-cloud.archive.canonical.com
1508
1509=== modified file 'usr/bin/orange-box-demo-cleanup'
1510--- usr/bin/orange-box-demo-cleanup 2014-10-23 22:18:49 +0000
1511+++ usr/bin/orange-box-demo-cleanup 2015-07-23 19:54:40 +0000
1512@@ -20,6 +20,8 @@
1513
1514 ENVIRONMENT=`juju env`
1515
1516+. /etc/orange-box.conf
1517+
1518 #Destroy juju environment
1519 juju destroy-environment $ENVIRONMENT
1520 #make sure AMTs are all powered off
1521@@ -27,6 +29,6 @@
1522 if dpkg --compare-versions $maas_ver lt 1.6; then
1523 export AMT_PASSWORD=Password1+
1524 for i in $(seq 11 19); do
1525- yes | amttool 10.14.4.$i powerdown >/dev/null 2>&1
1526+ yes | amttool 172.27.${orangebox_number}.$i powerdown >/dev/null 2>&1
1527 done
1528 fi
1529
1530=== added file 'usr/bin/orange-box-hacks'
1531--- usr/bin/orange-box-hacks 1970-01-01 00:00:00 +0000
1532+++ usr/bin/orange-box-hacks 2015-07-23 19:54:40 +0000
1533@@ -0,0 +1,32 @@
1534+#!/bin/sh
1535+
1536+okay() {
1537+ echo "OK: $@"
1538+}
1539+
1540+error() {
1541+ echo "ERROR: $@"
1542+}
1543+
1544+# Check powerstate in AMT
1545+for i in $(seq 1 9); do
1546+ amtoutput=$(yes | amttool 10.14.4.1${i} info)
1547+ if [ "$amthostname" = "node${i}amt" ]; then
1548+ okay "[node${i}]: AMT is responsive"
1549+ else
1550+ error "[node${i}]: AMT is not responsive"
1551+ fi
1552+ amtpowerstate=$(echo "$amtoutput" | grep "^Powerstate:" | awk '{print $2}')
1553+ if [ -n "$amtpowerstate" ]; then
1554+ okay "[node${i}]: AMT powerstate [$amtpowerstate]"
1555+ else
1556+ error "[node${i}]: AMT powerstate unknown [$amtpowerstate]"
1557+ fi
1558+ uptime=$(ssh node$i.maas "uptime" 2>/dev/null)
1559+ if [ -n "$uptime" ]; then
1560+ okay "[node${i}]: SSH to node successful; uptime=[$uptime]"
1561+ else
1562+ error "[node${i}]: SSH to node unsuccessful; uptime=[$uptime]"
1563+ fi
1564+ echo
1565+done
1566
1567=== modified file 'usr/bin/orange-box-purge-everything'
1568--- usr/bin/orange-box-purge-everything 2014-10-08 11:51:07 +0000
1569+++ usr/bin/orange-box-purge-everything 2015-07-23 19:54:40 +0000
1570@@ -21,6 +21,7 @@
1571
1572 sudo apt-get purge $(dpkg -l | egrep "orange-box|maas|squid" | awk '{print $2}') bind9
1573 rm -rf /srv/boot-resources/* /etc/bind /root/.maascli.db
1574+rm -rf /home/ubuntu/.juju/environments/
1575 echo
1576 echo "=== IT IS HIGHLY RECOMMENDED THAT YOU REBOOT NOW! ==="
1577 echo
1578
1579=== modified file 'usr/bin/orange-box-run'
1580--- usr/bin/orange-box-run 2014-06-11 01:00:16 +0000
1581+++ usr/bin/orange-box-run 2015-07-23 19:54:40 +0000
1582@@ -24,22 +24,25 @@
1583 cmd="tail -f /var/log/cloud-init-output.log | ccze -A"
1584 fi
1585
1586-tmux new-window -n all-nodes "ssh node1.maas $cmd" \; \
1587- split-window -v "ssh node2.maas $cmd" \; \
1588- select-layout tiled \; \
1589- split-window -h "ssh node2.maas $cmd" \; \
1590- select-layout tiled \; \
1591- split-window -v "ssh node3.maas $cmd" \; \
1592- select-layout tiled \; \
1593- split-window -h "ssh node4.maas $cmd" \; \
1594- select-layout tiled \; \
1595- split-window -v "ssh node5.maas $cmd" \; \
1596- select-layout tiled \; \
1597- split-window -h "ssh node6.maas $cmd" \; \
1598- select-layout tiled \; \
1599- split-window -v "ssh node7.maas $cmd" \; \
1600- select-layout tiled \; \
1601- split-window -h "ssh node8.maas $cmd" \; \
1602- select-layout tiled \; \
1603- split-window -v "ssh node9.maas $cmd" \; \
1604+## According to OB network re-design
1605+. /etc/orange-box.conf
1606+
1607+tmux new-window -n all-nodes "ssh node1ob${orangebox_number}.maas $cmd" \; \
1608+ split-window -v "ssh node2ob${orangebox_number}.maas $cmd" \; \
1609+ select-layout tiled \; \
1610+ split-window -h "ssh node2ob${orangebox_number}.maas $cmd" \; \
1611+ select-layout tiled \; \
1612+ split-window -v "ssh node3ob${orangebox_number}.maas $cmd" \; \
1613+ select-layout tiled \; \
1614+ split-window -h "ssh node4ob${orangebox_number}.maas $cmd" \; \
1615+ select-layout tiled \; \
1616+ split-window -v "ssh node5ob${orangebox_number}.maas $cmd" \; \
1617+ select-layout tiled \; \
1618+ split-window -h "ssh node6ob${orangebox_number}.maas $cmd" \; \
1619+ select-layout tiled \; \
1620+ split-window -v "ssh node7ob${orangebox_number}.maas $cmd" \; \
1621+ select-layout tiled \; \
1622+ split-window -h "ssh node8ob${orangebox_number}.maas $cmd" \; \
1623+ select-layout tiled \; \
1624+ split-window -v "ssh node9ob${orangebox_number}.maas $cmd" \; \
1625 select-layout tiled
1626
1627=== added file 'usr/bin/orange-box-setup-nat'
1628--- usr/bin/orange-box-setup-nat 1970-01-01 00:00:00 +0000
1629+++ usr/bin/orange-box-setup-nat 2015-07-23 19:54:40 +0000
1630@@ -0,0 +1,127 @@
1631+#!/bin/bash
1632+#
1633+# orange-box-setup-nat - Setup NAT for external network access by nodes
1634+# Copyright (C) 2014 Canonical Ltd.
1635+#
1636+# Authors: Ronald McCollam <ronald.mccollam@canonical.com>
1637+# Dustin Kirkland <kirkland@canonical.com>
1638+#
1639+# This program is free software: you can redistribute it and/or modify
1640+# it under the terms of the GNU General Public License as published by
1641+# the Free Software Foundation, version 3 of the License.
1642+#
1643+# This program is distributed in the hope that it will be useful,
1644+# but WITHOUT ANY WARRANTY; without even the implied warranty of
1645+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1646+# GNU General Public License for more details.
1647+#
1648+# You should have received a copy of the GNU General Public License
1649+# along with this program. If not, see <http://www.gnu.org/licenses/>.
1650+
1651+set -x
1652+
1653+if [ "$(id -u)" != "0" ]; then
1654+ echo "Must be run with sudo or by root"
1655+ exit 77
1656+fi
1657+
1658+# Don't bother to restart sshd when lo is configured.
1659+if [ "$IFACE" = lo ]; then
1660+ exit 0
1661+fi
1662+
1663+# According to OB network re-design
1664+. /etc/orange-box.conf
1665+
1666+
1667+##internal=$(route -n | grep "^10\.14\." | sed -e "s/.* //")
1668+internal=$(route -n | grep "^172\.27\.${orangebox_number}\." | sed -e "s/.* //")
1669+external=$(ip route ls | grep ^default | awk '{print $5}')
1670+
1671+if [ -z "$internal" ] || [ -z "$external" ]; then
1672+ echo "usage: $0 [INTERNAL_INTERFACE] [EXTERNAL_INTERFACE]" 1>&2
1673+ exit 1
1674+fi
1675+
1676+set -e
1677+
1678+# Update MAAS upstream DNS
1679+maas admin maas set-config name=upstream_dns value=172.27.252.1 || true
1680+
1681+# Intel Centrino Advanced-N 6235 and Ubuntu don't work well with Wireless-N
1682+if lspci -v 2>/dev/null | grep -qs "Centrino Advanced-N 6235" 2>/dev/null; then
1683+ sed -i -e "/options iwlwifi 11n_disable=1/d" /etc/modprobe.d/iwlwifi.conf
1684+ echo "options iwlwifi 11n_disable=1" >> /etc/modprobe.d/iwlwifi.conf
1685+fi
1686+
1687+# Configure NAT and IP forwarding, giving slave NUCs external network access
1688+# through the master.
1689+
1690+# Enable IP forwarding and save for next boot
1691+echo 1 > /proc/sys/net/ipv4/ip_forward
1692+echo "net.ipv4.ip_forward=1" > /etc/sysctl.d/10-maas-ip-forward.conf
1693+echo "net.ipv4.conf.all.accept_redirects=1 >> /etc/sysctl.d/10-maas-ip-forward.conf"
1694+echo "net.ipv6.conf.all.accept_redirects=1 >> /etc/sysctl.d/10-maas-ip-forward.conf"
1695+echo "net.ipv4.conf.all.send_redirects=1 >> /etc/sysctl.d/10-maas-ip-forward.conf"
1696+sysctl --system
1697+
1698+#Create the static ip tables for multi OBs.
1699+cat > /etc/rc.local <<EOF
1700+#!/bin/sh -e
1701+#
1702+# rc.local
1703+#
1704+# This script is executed at the end of each multiuser runlevel.
1705+# Make sure that the script will "exit 0" on success or any other
1706+# value on error.
1707+#
1708+# In order to enable or disable this script just change the execution
1709+# bits.
1710+#
1711+# By default this script does nothing.
1712+
1713+EOF
1714+for obn in `seq 4 4 80`
1715+do
1716+ [[ $obn == ${orangebox_number} ]] ||echo " ip route add 172.27.$obn.0/22 via 172.27.252.$obn " >> /etc/rc.local
1717+done
1718+echo "exit 0" >> /etc/rc.local
1719+
1720+# Note that this script assumes no existing iptables rules. If you do have
1721+# any, they will be deleted.
1722+iptables --flush
1723+iptables --table nat --flush
1724+iptables --delete-chain
1725+iptables --table nat --delete-chain
1726+
1727+# Firewalling this machine
1728+# Allow incoming SSH
1729+iptables -A INPUT -i $external -p tcp --dport 22 -j ACCEPT
1730+iptables -A INPUT -i $external -m state --state ESTABLISHED,RELATED -j ACCEPT
1731+###iptables -A INPUT -i $external -j DROP
1732+
1733+# Some things use the MAAS proxy - some things don't. So turn on NAT.
1734+echo "Setting up ip forwarding"
1735+iptables -t nat -A POSTROUTING -o $external -j MASQUERADE
1736+iptables -A FORWARD -i $external -o $internal -m state --state RELATED,ESTABLISHED -j ACCEPT
1737+iptables -A FORWARD -i $internal -o $external -j ACCEPT
1738+# The following line sets up a transparent proxy
1739+iptables -A PREROUTING -t nat -i br0 -p tcp -m multiport --dports 80 -j REDIRECT --to-port 3128
1740+
1741+iptables-save > /etc/iptables/rules.v4
1742+
1743+# 14.10 deprecates the iptables-persistent service in favor of netfilter-persistent
1744+service iptables-persistent restart || service netfilter-persistent restart
1745+
1746+# It seems we need to restart squid3 after making these network changes
1747+maas_ver=$(dpkg -l maas | tail -n1 | awk '{print $3}')
1748+if dpkg --compare-versions $maas_ver lt 1.6; then
1749+# We now run squid3, and NOT squid-deb-proxy
1750+ update-rc.d -f squid-deb-proxy remove || true
1751+ service squid-deb-proxy stop || true
1752+ service squid3 stop || true
1753+ service squid3 start
1754+else
1755+ service maas-proxy stop || true
1756+ service maas-proxy start || true
1757+fi
1758
1759=== removed file 'usr/bin/orange-box-setup-nat'
1760--- usr/bin/orange-box-setup-nat 2014-10-08 11:51:07 +0000
1761+++ usr/bin/orange-box-setup-nat 1970-01-01 00:00:00 +0000
1762@@ -1,99 +0,0 @@
1763-#!/bin/bash
1764-#
1765-# orange-box-setup-nat - Setup NAT for external network access by nodes
1766-# Copyright (C) 2014 Canonical Ltd.
1767-#
1768-# Authors: Ronald McCollam <ronald.mccollam@canonical.com>
1769-# Dustin Kirkland <kirkland@canonical.com>
1770-#
1771-# This program is free software: you can redistribute it and/or modify
1772-# it under the terms of the GNU General Public License as published by
1773-# the Free Software Foundation, version 3 of the License.
1774-#
1775-# This program is distributed in the hope that it will be useful,
1776-# but WITHOUT ANY WARRANTY; without even the implied warranty of
1777-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1778-# GNU General Public License for more details.
1779-#
1780-# You should have received a copy of the GNU General Public License
1781-# along with this program. If not, see <http://www.gnu.org/licenses/>.
1782-
1783-set -x
1784-
1785-if [ "$(id -u)" != "0" ]; then
1786- echo "Must be run with sudo or by root"
1787- exit 77
1788-fi
1789-
1790-# Don't bother to restart sshd when lo is configured.
1791-if [ "$IFACE" = lo ]; then
1792- exit 0
1793-fi
1794-
1795-internal=$(route -n | grep "^10\.14\." | sed -e "s/.* //")
1796-external=$(ip route ls | grep ^default | awk '{print $5}')
1797-
1798-
1799-if [ -z "$internal" ] || [ -z "$external" ]; then
1800- echo "usage: $0 [INTERNAL_INTERFACE] [EXTERNAL_INTERFACE]" 1>&2
1801- exit 1
1802-fi
1803-
1804-set -e
1805-
1806-# Update MAAS upstream DNS
1807-dns=$(nmcli d list iface $external | grep -m 1 "^IP4.DNS" | awk '{ print $2 }')
1808-maas admin maas set-config name=upstream_dns value=$dns || true
1809-
1810-# Intel Centrino Advanced-N 6235 and Ubuntu don't work well with Wireless-N
1811-if lspci -v 2>/dev/null | grep -qs "Centrino Advanced-N 6235" 2>/dev/null; then
1812- sed -i -e "/options iwlwifi 11n_disable=1/d" /etc/modprobe.d/iwlwifi.conf
1813- echo "options iwlwifi 11n_disable=1" >> /etc/modprobe.d/iwlwifi.conf
1814-fi
1815-
1816-# Configure NAT and IP forwarding, giving slave NUCs external network access
1817-# through the master.
1818-
1819-# Enable IP forwarding and save for next boot
1820-echo 1 > /proc/sys/net/ipv4/ip_forward
1821-echo "net.ipv4.ip_forward=1" > /etc/sysctl.d/10-maas-ip-forward.conf
1822-sysctl --system
1823-
1824-# Note that this script assumes no existing iptables rules. If you do have
1825-# any, they will be deleted.
1826-iptables --flush
1827-iptables --table nat --flush
1828-iptables --delete-chain
1829-iptables --table nat --delete-chain
1830-
1831-# Firewalling this machine
1832-# Allow incoming SSH
1833-iptables -A INPUT -i $external -p tcp --dport 22 -j ACCEPT
1834-iptables -A INPUT -i $external -m state --state ESTABLISHED,RELATED -j ACCEPT
1835-iptables -A INPUT -i $external -j DROP
1836-
1837-# Some things use the MAAS proxy - some things don't. So turn on NAT.
1838-echo "Setting up ip forwarding"
1839-iptables -t nat -A POSTROUTING -o $external -j MASQUERADE
1840-iptables -A FORWARD -i $external -o $internal -m state --state RELATED,ESTABLISHED -j ACCEPT
1841-iptables -A FORWARD -i $internal -o $external -j ACCEPT
1842-# The following line sets up a transparent proxy
1843-iptables -A PREROUTING -t nat -i br0 -p tcp -m multiport --dports 80 -j REDIRECT --to-port 3128
1844-
1845-iptables-save > /etc/iptables/rules.v4
1846-
1847-# 14.10 deprecates the iptables-persistent service in favor of netfilter-persistent
1848-service iptables-persistent restart || service netfilter-persistent restart
1849-
1850-# It seems we need to restart squid3 after making these network changes
1851-maas_ver=$(dpkg -l maas | tail -n1 | awk '{print $3}')
1852-if dpkg --compare-versions $maas_ver lt 1.6; then
1853-# We now run squid3, and NOT squid-deb-proxy
1854- update-rc.d -f squid-deb-proxy remove || true
1855- service squid-deb-proxy stop || true
1856- service squid3 stop || true
1857- service squid3 start
1858-else
1859- service maas-proxy stop || true
1860- service maas-proxy start || true
1861-fi
1862
1863=== modified file 'usr/bin/orange-box-status-all-nodes'
1864--- usr/bin/orange-box-status-all-nodes 2014-10-20 11:58:14 +0000
1865+++ usr/bin/orange-box-status-all-nodes 2015-07-23 19:54:40 +0000
1866@@ -22,6 +22,9 @@
1867 export AMT_PASSWORD=Password1+
1868 ERRORS=0
1869
1870+## According to OB network re-design
1871+. /etc/orange-box.conf
1872+
1873 okay() {
1874 echo "OK: $@"
1875 }
1876@@ -35,23 +38,23 @@
1877 status_all_nodes() {
1878 # Check all VM nodes
1879 for i in $(seq 0 2); do
1880- if virsh list --all | grep node0vm${i} | grep running >/dev/null 2>&1; then
1881- okay "[node0vm${i}]: Is running"
1882- uptime=$(ssh node0vm${i}.maas "uptime" 2>/dev/null)
1883+ if virsh list --all | grep node0vm${i}ob${orangebox_number} | grep running >/dev/null 2>&1; then
1884+ okay "[node0vm${i}ob${orangebox_number}]: Is running"
1885+ uptime=$(ssh node0vm${i}ob${orangebox_number}.maas "uptime" 2>/dev/null)
1886 if [ -n "$uptime" ]; then
1887- okay "[node0vm${i}]: SSH to node successful; uptime=[$uptime]"
1888+ okay "[node0vm${i}ob${orangebox_number}]: SSH to node successful; uptime=[$uptime]"
1889 else
1890- error "[node0vm${i}]: SSH to node unsuccessful; uptime=[$uptime]"
1891+ error "[node0vm${i}ob${orangebox_number}]: SSH to node unsuccessful; uptime=[$uptime]"
1892 fi
1893 else
1894- error "[node0vm${i}]: Is not running"
1895+ error "[node0vm${i}ob${orangebox_number}]: Is not running"
1896 fi
1897 done
1898 # Check all AMT nodes
1899 for i in $(seq 1 9); do
1900- hostname="node${i}.maas"
1901+ hostname="node${i}ob${orangebox_number}.maas"
1902 # (1) Ping AMT IP Addresses
1903- amt_ip="10.14.4.1$i"
1904+ amt_ip="172.27.${orangebox_number}.1$i"
1905 if ping -c 1 -q $amt_ip >/dev/null 2>&1; then
1906 okay "[$hostname]: AMT responding to ping [$amt_ip]"
1907 else

Subscribers

People subscribed via source and target branches