This repository has been archived by the owner on Dec 3, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 79
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #312 from nre-learning/git-updates
Updating stage 2 for git lesson and adding stage 3
- Loading branch information
Showing
13 changed files
with
365 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
#!/bin/bash | ||
|
||
# Catch up from previous sections | ||
rm -rf /home/antidote/myfirstrepo | ||
mkdir -p /home/antidote/myfirstrepo | ||
cd /home/antidote/myfirstrepo | ||
git init | ||
git config --global user.email "jane@nrelabs.io" | ||
git config --global user.name "Jane Doe" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
30 changes: 30 additions & 0 deletions
30
lessons/fundamentals/lesson-17-git/stage2/interface-config.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
interfaces { | ||
em0 { | ||
unit 0 { | ||
family inet { | ||
address 10.0.0.15/24; | ||
} | ||
} | ||
} | ||
em1 { | ||
unit 0 { | ||
family inet { | ||
address 169.254.0.2/24; | ||
} | ||
} | ||
} | ||
em3 { | ||
unit 0 { | ||
family inet { | ||
address 10.31.0.11/24; | ||
} | ||
} | ||
} | ||
em4 { | ||
unit 0 { | ||
family inet { | ||
address 10.12.0.11/24; | ||
} | ||
} | ||
} | ||
} |
11 changes: 11 additions & 0 deletions
11
lessons/fundamentals/lesson-17-git/stage3/bumbling-fred.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
#!/bin/bash | ||
|
||
# This script simulates fred not only making a commit directly on `master` (which isn't very team-friendly) | ||
# but also changing the same line we're working on in our branch, which means we'll have a merge conflict | ||
# when we merge our branch back to master | ||
|
||
git checkout master > /dev/null 2>&1 | ||
sed -i s/10.31.0.11/123.123.123.123/ interface-config.txt > /dev/null 2>&1 | ||
git add interface-config.txt > /dev/null 2>&1 | ||
git commit -m "I'm fred and I'm conficting with your change!" > /dev/null 2>&1 | ||
git checkout change-123 > /dev/null 2>&1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
#!/bin/bash | ||
|
||
# This script simulates a change approval for change 124 occurring while we're working on a branch | ||
# for change 123. It checks out master, then merges 124 into master, and then checks out change 123 | ||
# so we can see the difference between our 123 change and the new master branch | ||
|
||
git checkout master > /dev/null 2>&1 | ||
git merge change-124 master > /dev/null 2>&1 | ||
git checkout change-123 > /dev/null 2>&1 |
25 changes: 25 additions & 0 deletions
25
lessons/fundamentals/lesson-17-git/stage3/configs/catchup.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
#!/bin/bash | ||
|
||
# Catch up from previous sections | ||
rm -rf /home/antidote/myfirstrepo | ||
mkdir -p /home/antidote/myfirstrepo | ||
cd /home/antidote/myfirstrepo | ||
git init | ||
git config --global user.email "jane@nrelabs.io" | ||
git config --global user.name "Jane Doe" | ||
cp /antidote/stage3/interface-config.txt . | ||
git add interface-config.txt | ||
git commit -m "Adding new interface configuration file" | ||
|
||
# simulate Fred's change | ||
git config --global user.email "fred@nrelabs.io" | ||
git config --global user.name "Fred Smith" | ||
git checkout -b change-124 | ||
sed -i s/10.12.0.11/10.12.0.12/ interface-config.txt | ||
git add interface-config.txt | ||
git commit -s -m "Updated em4 IP address" | ||
|
||
# Prepare for learner | ||
git config --global user.email "jane@nrelabs.io" | ||
git config --global user.name "Jane Doe" | ||
git checkout master |
17 changes: 17 additions & 0 deletions
17
lessons/fundamentals/lesson-17-git/stage3/configs/linux1.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import paramiko | ||
import os | ||
from scp import SCPClient | ||
|
||
host=os.environ['SYRINGE_TARGET_HOST'] | ||
|
||
def createSSHClient(server, port, user, password): | ||
client = paramiko.SSHClient() | ||
client.set_missing_host_key_policy(paramiko.AutoAddPolicy()) | ||
client.connect(server, port, user, password) | ||
return client | ||
|
||
ssh=createSSHClient(host,22,"antidote","antidotepassword") | ||
|
||
ssh.exec_command('/antidote/stage3/configs/catchup.sh') | ||
|
||
ssh.close() |
Oops, something went wrong.